from collections import Counter

from itertools import groupby

from operator import itemgetter



c = Counter(eval(input()) for _ in range(int(eval(input()))))

a = sorted((-c[x],x) for x in c)

for _, s in next(groupby(a, itemgetter(0)))[1]:

  print(s)

from itertools import groupby

from operator import itemgetter



a = sorted(eval(input()) for _ in range(int(eval(input()))))

a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))

for _, s in next(groupby(a, itemgetter(0)))[1]:

  print(s)

from collections import Counter
from itertools import groupby
from operator import itemgetter

c = Counter(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-c[x], x) for x in c)
for _, s in next(groupby(a, itemgetter(0)))[1]:
    print(s)

from itertools import groupby
from operator import itemgetter

a = sorted(eval(input()) for _ in range(int(eval(input()))))
a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))
for _, s in next(groupby(a, itemgetter(0)))[1]:
    print(s)

-from collections import Counter -c = Counter(eval(input()) for _ in range(int(eval(input())))) -a = sorted((-c[x], x) for x in c) +a = sorted(eval(input()) for _ in range(int(eval(input())))) +a = sorted((-sum(1 for _ in g), s) for s, g in groupby(a))