from collections import defaultdict

n = int(input())



d = defaultdict(int)

for _ in range(n):

    key = input()

    d[key] += 1



dict = sorted(d.items(), key=lambda x:x[1], reverse=True)

max_v = max(d.values())



dict_li = []

for a in dict:

    if a[1]==max_v:

        dict_li.append(a[0])



dict_li.sort()

print(*dict_li, sep='\n')

from collections import Counter

n = int(eval(input()))

s = [eval(input()) for _ in range(n)]

cnt = Counter(s)

max_v = max(cnt.values())

ans = [s for s,c in list(cnt.items()) if c==max_v]

ans.sort()

print(('\n'.join(ans)))
from collections import defaultdict

n = int(input())
d = defaultdict(int)
for _ in range(n):
    key = input()
    d[key] += 1
dict = sorted(d.items(), key=lambda x: x[1], reverse=True)
max_v = max(d.values())
dict_li = []
for a in dict:
    if a[1] == max_v:
        dict_li.append(a[0])
dict_li.sort()
print(*dict_li, sep="\n")

from collections import Counter

n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
cnt = Counter(s)
max_v = max(cnt.values())
ans = [s for s, c in list(cnt.items()) if c == max_v]
ans.sort()
print(("\n".join(ans)))

-from collections import defaultdict +from collections import Counter -n = int(input()) -d = defaultdict(int) -for _ in range(n): -    key = input() -    d[key] += 1 -dict = sorted(d.items(), key=lambda x: x[1], reverse=True) -max_v = max(d.values()) -dict_li = [] -for a in dict: -    if a[1] == max_v: -        dict_li.append(a[0]) -dict_li.sort() -print(*dict_li, sep="\n") +n = int(eval(input())) +s = [eval(input()) for _ in range(n)] +cnt = Counter(s) +max_v = max(cnt.values()) +ans = [s for s, c in list(cnt.items()) if c == max_v] +ans.sort() +print(("\n".join(ans)))