n = int(eval(input()))

list_S = []

for _ in range(n):

    list_S.append(eval(input()))



dic_S = dict()

set_S = set()

for s in list_S:

    if s in set_S:

        dic_S[s] += 1

    else:

        dic_S[s] = 1

        set_S.add(s)



list_ans = sorted(list(dic_S.items()), key=lambda x:x[1], reverse=True)

a = 0

ans = []

for i in range(len(list_ans)):

    l = list_ans[i]

    a = max(a, l[1])

    if a <= l[1]:

        ans.append(l[0])

ans.sort()

for s in ans:

    print(s)
from collections import Counter

n = int(eval(input()))

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

dic_S = Counter(list_S)

m = 0

for i in list(dic_S.values()):

    m = max(m, i)

ans = []

for k, v in list(dic_S.items()):

    if v == m:

       ans.append(k)

ans.sort()

for s in ans:

    print(s)
n = int(eval(input()))
list_S = []
for _ in range(n):
    list_S.append(eval(input()))
dic_S = dict()
set_S = set()
for s in list_S:
    if s in set_S:
        dic_S[s] += 1
    else:
        dic_S[s] = 1
        set_S.add(s)
list_ans = sorted(list(dic_S.items()), key=lambda x: x[1], reverse=True)
a = 0
ans = []
for i in range(len(list_ans)):
    l = list_ans[i]
    a = max(a, l[1])
    if a <= l[1]:
        ans.append(l[0])
ans.sort()
for s in ans:
    print(s)

from collections import Counter

n = int(eval(input()))
list_S = [eval(input()) for _ in range(n)]
dic_S = Counter(list_S)
m = 0
for i in list(dic_S.values()):
    m = max(m, i)
ans = []
for k, v in list(dic_S.items()):
    if v == m:
        ans.append(k)
ans.sort()
for s in ans:
    print(s)

+from collections import Counter + -list_S = [] -for _ in range(n): -    list_S.append(eval(input())) -dic_S = dict() -set_S = set() -for s in list_S: -    if s in set_S: -        dic_S[s] += 1 -    else: -        dic_S[s] = 1 -        set_S.add(s) -list_ans = sorted(list(dic_S.items()), key=lambda x: x[1], reverse=True) -a = 0 +list_S = [eval(input()) for _ in range(n)] +dic_S = Counter(list_S) +m = 0 +for i in list(dic_S.values()): +    m = max(m, i) -for i in range(len(list_ans)): -    l = list_ans[i] -    a = max(a, l[1]) -    if a <= l[1]: -        ans.append(l[0]) +for k, v in list(dic_S.items()): +    if v == m: +        ans.append(k)