#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
int n,maxnum;
string a,maxstr;
map<string, int> m;
int main()
{
while(cin >> n&&n){
m.clear();
for(int i =0; i < n; i++){
cin >> a;
m[a]++;
}
maxnum=0;
map<string, int>::iterator iter;
for(iter = m.begin();iter != m.end();iter++){
if(maxnum < iter->second){
maxnum=iter->second;
maxstr=iter->first;
}
}
cout <<maxstr<<endl;
}
return 0;
}
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
int n,maxnum;
string a,maxstr;
map<string, int> m;
int main()
{
while(cin >> n&&n){
m.clear();
for(int i =0; i < n; i++){
cin >> a;
m[a]++;
}
maxnum=0;
map<string, int>::iterator iter;
for(iter = m.begin();iter != m.end();iter++){
if(maxnum < iter->second){
maxnum=iter->second;
maxstr=iter->first;
}
}
cout <<maxstr<<endl;
}
return 0;
}