import sys

from collections import defaultdict



sys.setrecursionlimit(10**7)

input = sys.stdin.readline



n = int(eval(input()))



d = defaultdict(int)

for i in range(n):

    s = input().rstrip()

    d[s] += 1



ma = 0

for v in list(d.values()):

    ma = max(ma, v)



a = sorted(d.items())

for k, v in a:

    if ma == v:

        print(k)

import sys

from collections import Counter



sys.setrecursionlimit(10**7)

input = sys.stdin.readline



n = int(input())

cnt = Counter(input() for _ in range(n))

macnt = max(cnt.values())

names = [k for k, v in cnt.items() if v == macnt]

names.sort()

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

import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(eval(input()))
d = defaultdict(int)
for i in range(n):
    s = input().rstrip()
    d[s] += 1
ma = 0
for v in list(d.values()):
    ma = max(ma, v)
a = sorted(d.items())
for k, v in a:
    if ma == v:
        print(k)

import sys
from collections import Counter

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n = int(input())
cnt = Counter(input() for _ in range(n))
macnt = max(cnt.values())
names = [k for k, v in cnt.items() if v == macnt]
names.sort()
print(*names, sep="\n")

-from collections import defaultdict +from collections import Counter -n = int(eval(input())) -d = defaultdict(int) -for i in range(n): -    s = input().rstrip() -    d[s] += 1 -ma = 0 -for v in list(d.values()): -    ma = max(ma, v) -a = sorted(d.items()) -for k, v in a: -    if ma == v: -        print(k) +n = int(input()) +cnt = Counter(input() for _ in range(n)) +macnt = max(cnt.values()) +names = [k for k, v in cnt.items() if v == macnt] +names.sort() +print(*names, sep="\n")