STL map
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
using namespace std;
map<string,int> mp;
int main()
{
string ans,tmp;
int maxn,n;
while(cin >> n && n)
{
maxn = 0;
mp.clear();
while(n--)
{
cin >> tmp;
mp[tmp]++;
if(mp[tmp]>maxn)
{
ans = tmp;
maxn = mp[tmp];
}
}
cout << ans << endl;
}
return 0;
}