from collections import Counter



N = int(input())

S = [input() for _ in range(N)]

c = Counter(S)

m = max(c.values())

ans = sorted([(k,v) for k,v in c.items() if m==v], key=lambda x: (-x[1], x[0]))

[print(k[0])for k in ans]

from collections import Counter



N = int(input())

S = [input() for _ in range(N)]

c = Counter(S)

m = max(c.values())

ans = sorted([k for k,v in c.items() if m==v])

[print(k) for k in ans]

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
m = max(c.values())
ans = sorted([(k, v) for k, v in c.items() if m == v], key=lambda x: (-x[1], x[0]))
[print(k[0]) for k in ans]

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
m = max(c.values())
ans = sorted([k for k, v in c.items() if m == v])
[print(k) for k in ans]

-ans = sorted([(k, v) for k, v in c.items() if m == v], key=lambda x: (-x[1], x[0])) -[print(k[0]) for k in ans] +ans = sorted([k for k, v in c.items() if m == v]) +[print(k) for k in ans]