import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
String[] str = new String[1001];
int[] count = new int[1001]; // 计数声明初始化为1
for (int i = 0; i <= 1000; i++) {
count[i] = 1;
}
int N = scanner.nextInt();
if (N == 0) {
break;
}
for (int i = 0; i < N; i++) {
String per_str = scanner.next();
str[i] = per_str;
if (i >= 1) {
for (int j = 0; j <= i; j++) {
if (str[i].equals(str[j])) {
count[j]++;
}
}
}
}
int max = count[0], index = 0;
for (int i = 0; i < count.length; i++) {
if (count[i] > max) {
max = count[i];
index = i;
}
}
System.out.println(str[index]);
}
}
}