#pragma GCC optimize (2)
#pragma G++ optimize (2)
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define wuyt main
typedef long long ll;
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
//#define getchar()(p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
if(c == '-')Nig = -1,c = getchar();
while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
return Nig*x;}
#define read read()
const ll inf = 1e15;
const int maxn = 1e6 + 7;
const int mod = 1e9 + 7;
int num[maxn];
map<string,ll>mp;
map<string,ll>::iterator it;
string ss[maxn];
int main()
{
    /**int n=read;
    int flag=1;
    for(int i=1;i<=n;i++)
    {
        num[i]=read;
        if(num[i]%2==0){
            if(num[i]%3!=0&&num[i]%5!=0)
                flag=0;
        }
    }
    if(flag==0) printf("DENIED\n");
    if(flag) printf("APPROVED\n");**/
        /**
        int n=read;
    string ss;
    map<string,int>mp;
    for(int i=0;i<n;i++)
    {
        ///scanf("%s",ss);
        cin>>ss;
        mp[ss]++;
    }
    int cnt=0;
    for(auto& v:mp) cnt=max(cnt,v.second);
    for(auto& v:mp){
        if(v.second==cnt)
            ///cout<<v.first<<endl;
            printf("%s\n",v.first);
    }
    ll n;
    ios_base::sync_with_stdio(false);
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        ///scanf("%s",ss);
        ///getchar();
        string ss;
        cin>>ss;
        mp[ss]++;
    }
    int maxx=-1;
    for(const auto& x : mp){
        int temp=x.second;
        if(temp>maxx) maxx=temp;
    }
    for(auto it=mp.begin();it!=mp.end();it++){
        if(it->second==maxx)
            ///cout<<it->first<<endl;
            printf("%s\n",it->first);
    }
    int n;
    cin>>n;
    int maxx=0;
    for(int i=1;i<=n;i++)
    {
        string s;
        ///scanf("%s",&s);
        cin>>s;
        mp[s]++;
        maxx=max(maxx,mp[s]);
    }
    for(auto x:mp)
        if(x.second==maxx)
            cout<<x.first<<endl;**/
    ll n=read;
    ll maxx=0;
    for(ll i=1;i<=n;i++){
        cin>>ss[i];
        mp[ss[i]]++;
    }
    for(it=mp.begin();it!=mp.end();it++)
        maxx=max(maxx,it->second);
    sort(ss+1,ss+1+n);
    for(ll i=1;i<=n;i++){
        if(mp[ss[i]]!=maxx) continue;
        ll len=ss[i].length();
        for(ll j=0;j<len;j++)
            putchar(ss[i][j]);
        printf("\n");
        mp[ss[i]]=0;
    }
	return 0;
}
/**ll kruskal(){
    sort(num,num+m,cmp);
    for(ll i=1;i<=n;i++) num2[i]=i;
    ll res=0,cnt=0;
    for(ll i=0;i<m;i++){
        ll aa=num[i].a,b=num[i].b,w=num[i].w;
        aa=searchnum(aa),b=searchnum(b);
        if(aa!=b){
            num2[aa]=b;
            res+=w;
            cnt++;
        }
    }
    if(cnt<n-1) return inf;
    else return res;
}**/


Measured memory_bytes: 42752