/*
重复字符串统计
重复的,提前计数
新出现的,先新建,再计数
*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <string>
#include <cstring>
#include <sstream>
using namespace std;
#define input freopen("input.txt","r",stdin);
#define output freopen("output.txt","w",stdout);
#define For1(i,a,b) for (i=a;i<b;i++)
#define For2(i,a,b) for (i=a;i<=b;i++)
#define Dec(i,a,b) for (i=a;i>b;i--)
#define Dec2(i,a,b) for (i=a;i>=b;i--)
#define Sca_d(x) scanf("%d",&x)
#define Sca_s(x) scanf("%s",x)
#define Sca_c(x) scanf("%c",&x)
#define Sca_f(x) scanf("%f",&x)
#define Sca_lf(x) scanf("%lf",&x)
#define Fill(x,a) memset(x,a,sizeof(x))
#define MAXN 0x7fffffff
#define MAX 1005
char ch[MAX][20];
int book[MAX];
int main()
{
//input;
char in[20];
int i,j,k,n,pos,max_num,flag;
while(cin>>n)
{
if (!n) break;
Fill(ch,0);
Fill(book,0);
i=j=k=pos=max_num=0;
For2(i,1,n)
{
int flag=1;
Sca_s(in);
For2(j,1,k)
if (strcmp(in,ch[j])==0)
{
book[j]++;
flag=0;
break;
}
if (flag)
{
k++;
strcpy(ch[k],in);
book[k]++;
}
}
For2(i,1,k)
if (book[i]>max_num)
max_num=book[i],pos=i;
cout<<ch[pos]<<endl;
}
return 0;
}