from collections import Counter

import heapq



n = int(eval(input()))

ss = []

for _ in range(n):

    ss.append(input().rstrip())

ctr = Counter(ss)

heap = [(-v, k) for k, v in list(ctr.items())]

heapq.heapify(heap)

maxv = heap[0][0]

while heap:

    c = heapq.heappop(heap)

    if c[0] != maxv:

        break

    print((c[1]))

from collections import Counter



n = int(eval(input()))

ss = []

for _ in range(n):

    ss.append(input().rstrip())

ctr = Counter(ss)



a = sorted([(-v, k) for k, v in list(ctr.items())])

maxv = a[0][0]

for i in range(len(a)):

    if a[i][0] != maxv:

        break

    print((a[i][1]))
from collections import Counter
import heapq

n = int(eval(input()))
ss = []
for _ in range(n):
    ss.append(input().rstrip())
ctr = Counter(ss)
heap = [(-v, k) for k, v in list(ctr.items())]
heapq.heapify(heap)
maxv = heap[0][0]
while heap:
    c = heapq.heappop(heap)
    if c[0] != maxv:
        break
    print((c[1]))

from collections import Counter

n = int(eval(input()))
ss = []
for _ in range(n):
    ss.append(input().rstrip())
ctr = Counter(ss)
a = sorted([(-v, k) for k, v in list(ctr.items())])
maxv = a[0][0]
for i in range(len(a)):
    if a[i][0] != maxv:
        break
    print((a[i][1]))

-import heapq -heap = [(-v, k) for k, v in list(ctr.items())] -heapq.heapify(heap) -maxv = heap[0][0] -while heap: -    c = heapq.heappop(heap) -    if c[0] != maxv: +a = sorted([(-v, k) for k, v in list(ctr.items())]) +maxv = a[0][0] +for i in range(len(a)): +    if a[i][0] != maxv: -    print((c[1])) +    print((a[i][1]))