import java.util.Scanner;
public class HDU1004 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = 0, f = 0;
String a = null;
while (sc.hasNext()) {
n = sc.nextInt();
int pre = 0;
if (n > 0 && n <= 1000) {
String[] s = new String[n];
int i = 0;
while (n > 0) {
a = sc.next();
if (a.length() > 0 && a.length() <= 15) {
s[i] = a;
i++;
n--;
} else {
return;
}
}
for (int j = 0; j < s.length - 1; j++) {
int now = 1;
if (s[j].equals(s[j + 1]))
now++;
if (now > pre) {
pre = now;
f = j;
}
}
System.out.println(s[f]);
} else if (n == 0) {
return;
}
}
}
}