import collections

import itertools



n = int(input())

l = [input() for _ in [0] * n]



counter = collections.Counter(l)



a = counter.most_common()[0][-1]

b = itertools.takewhile(

    lambda kv: kv[-1] == a, counter.most_common()

)



c = sorted(list(k for k, v in b))

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





import collections



n = int(input())

l = [input() for _ in [0] * n]



counted = collections.Counter(l)

#print(counted)

# 最頻値を求める

m = max(counted.values())

#print(m)

# 頻出数の文字を集める

chars = [key for key, value in counted.items()

             if value == m]



print(*sorted(chars),sep='\n')



import collections
import itertools

n = int(input())
l = [input() for _ in [0] * n]
counter = collections.Counter(l)
a = counter.most_common()[0][-1]
b = itertools.takewhile(lambda kv: kv[-1] == a, counter.most_common())
c = sorted(list(k for k, v in b))
print(*c, sep="\n")

import collections

n = int(input())
l = [input() for _ in [0] * n]
counted = collections.Counter(l)
# print(counted)
# 最頻値を求める
m = max(counted.values())
# print(m)
# 頻出数の文字を集める
chars = [key for key, value in counted.items() if value == m]
print(*sorted(chars), sep="\n")

-import itertools -counter = collections.Counter(l) -a = counter.most_common()[0][-1] -b = itertools.takewhile(lambda kv: kv[-1] == a, counter.most_common()) -c = sorted(list(k for k, v in b)) -print(*c, sep="\n") +counted = collections.Counter(l) +# print(counted) +# 最頻値を求める +m = max(counted.values()) +# print(m) +# 頻出数の文字を集める +chars = [key for key, value in counted.items() if value == m] +print(*sorted(chars), sep="\n")