from collections import Counter

import sys

input = sys.stdin.readline



def solve():

    N = int(eval(input()))

    Sss = [input().rstrip() for _ in range(N)]



    cnt = Counter(Sss)

    #print('cnt:', cnt)



    maxNum = max(cnt.values())

    #print('maxNum:', maxNum)



    anss = []

    for key, value in list(cnt.items()):

        if value == maxNum:

            anss.append(key)

    #print('anss:', anss)



    anss.sort()



    print(('\n'.join(anss)))





solve()

from collections import Counter

import sys

input = sys.stdin.readline



N = int(eval(input()))

Sss = [input().rstrip() for _ in range(N)]



cnt = Counter(Sss)



num = max(cnt.values())



anss = []

for key in sorted(cnt.keys()):

    if cnt[key] == num:

        anss.append(key)



print(('\n'.join(anss)))

from collections import Counter
import sys

input = sys.stdin.readline


def solve():
    N = int(eval(input()))
    Sss = [input().rstrip() for _ in range(N)]
    cnt = Counter(Sss)
    # print('cnt:', cnt)
    maxNum = max(cnt.values())
    # print('maxNum:', maxNum)
    anss = []
    for key, value in list(cnt.items()):
        if value == maxNum:
            anss.append(key)
    # print('anss:', anss)
    anss.sort()
    print(("\n".join(anss)))


solve()

from collections import Counter
import sys

input = sys.stdin.readline
N = int(eval(input()))
Sss = [input().rstrip() for _ in range(N)]
cnt = Counter(Sss)
num = max(cnt.values())
anss = []
for key in sorted(cnt.keys()):
    if cnt[key] == num:
        anss.append(key)
print(("\n".join(anss)))

- - -def solve(): -    N = int(eval(input())) -    Sss = [input().rstrip() for _ in range(N)] -    cnt = Counter(Sss) -    # print('cnt:', cnt) -    maxNum = max(cnt.values()) -    # print('maxNum:', maxNum) -    anss = [] -    for key, value in list(cnt.items()): -        if value == maxNum: -            anss.append(key) -    # print('anss:', anss) -    anss.sort() -    print(("\n".join(anss))) - - -solve() +N = int(eval(input())) +Sss = [input().rstrip() for _ in range(N)] +cnt = Counter(Sss) +num = max(cnt.values()) +anss = [] +for key in sorted(cnt.keys()): +    if cnt[key] == num: +        anss.append(key) +print(("\n".join(anss)))