http://acm.hdu.edu.cn/showproblem.php?pid=1004
#include <iostream>
using namespace std;
int main()
{
int n;
string str[1001];
while(cin>>n,n)
{
int max=0,maxloc,temp,loc;
for(int i=0;i<n;i++)
cin>>str[i];
for(int i=0;i<n;i++)
{
temp=0;
for(int j=0;j<n;j++)
{
if(str[i]==str[j])
{
loc=i;
temp++;
}
}
if(temp>max)
{
maxloc=loc;
max=temp;
}
}
cout<<str[maxloc]<<endl;
}
return 0;
}