#include <bits/stdc++.h>

using namespace std;

int main()
{
    vector<string> vec,vec_2,vec_1;
    static int counter=0,counter_1=0;
    int num;
    string word;
    cin>>num;
    for(int i=0;i<num;i++)
    {
        cin>>word;
        vec.push_back(word);
        vec_2.push_back(word);
        cin.ignore();
    }
    sort(vec.begin(),vec.end());
    for(int o=0;o<vec.size();o++)
    {
        if(vec[o]==vec[o+1] && o!=vec.size()-1)
           counter_1+=1;
        else
        {
            if(counter_1>counter && counter_1!=0 && o!=vec.size()-1)
               {counter=counter_1;counter_1=0;vec_1.erase(vec_1.begin(),vec_1.end());vec_1.push_back(vec[o]);}
            else if(counter_1==counter && counter_1!=0 && o!=vec.size()-1)
               {counter_1=0;vec_1.push_back(vec[o]);}
        }
    }
    if(counter!=0)
    {
       for(int r=0;r<vec_1.size();r++)
           cout<<vec_1[r]<<endl;
    }
    else
    {
        reverse(vec_2.begin(),vec_2.end());
        for(int y=0;y<vec.size();y++)
            cout<<vec_2[y]<<endl;
    }
    return 0;
}
