from collections import Counter

n=int(input().rstrip())

d=dict()

for _ in range(n):

    s=input().rstrip()

    if s not in d:

      d[s]=1

    else:

      d[s]+=1

ans=Counter(d).most_common()

ans.sort(key=lambda x: (-x[1],x[0]))

m=ans[0][1]

for i in ans:

    if i[1]!=m:

        break

    print((i[0]))
#import pysnooper

#import numpy

#import os,re,sys,operator

from collections import Counter,deque

#from operator import itemgetter,mul

#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations

from sys import stdin,setrecursionlimit

#from bisect import bisect_left,bisect_right

#from copy import deepcopy

#import heapq

#import math

#import string

#from time import time

#from functools import lru_cache,reduce

#from math import factorial,hypot

#import sys

#from fractions import gcd

setrecursionlimit(10**6)

input=stdin.readline



def main():

    n=int(input().rstrip())

    d=dict()

    for _ in range(n):

        s=input().rstrip()

        if s not in d: d[s]=1

        else: d[s]+=1

    ans=Counter(d).most_common()

    ans.sort(key=lambda x: (-x[1],x[0]))

    ma=ans[0][1]

    for i in ans:

        if i[1]!=ma: break

        print((i[0]))



if __name__=="__main__":

    main()
from collections import Counter

n = int(input().rstrip())
d = dict()
for _ in range(n):
    s = input().rstrip()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
ans = Counter(d).most_common()
ans.sort(key=lambda x: (-x[1], x[0]))
m = ans[0][1]
for i in ans:
    if i[1] != m:
        break
    print((i[0]))

# import pysnooper
# import numpy
# import os,re,sys,operator
from collections import Counter, deque

# from operator import itemgetter,mul
# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin, setrecursionlimit

# from bisect import bisect_left,bisect_right
# from copy import deepcopy
# import heapq
# import math
# import string
# from time import time
# from functools import lru_cache,reduce
# from math import factorial,hypot
# import sys
# from fractions import gcd
setrecursionlimit(10**6)
input = stdin.readline


def main():
    n = int(input().rstrip())
    d = dict()
    for _ in range(n):
        s = input().rstrip()
        if s not in d:
            d[s] = 1
        else:
            d[s] += 1
    ans = Counter(d).most_common()
    ans.sort(key=lambda x: (-x[1], x[0]))
    ma = ans[0][1]
    for i in ans:
        if i[1] != ma:
            break
        print((i[0]))


if __name__ == "__main__":
    main()

-from collections import Counter +# import pysnooper +# import numpy +# import os,re,sys,operator +from collections import Counter, deque -n = int(input().rstrip()) -d = dict() -for _ in range(n): -    s = input().rstrip() -    if s not in d: -        d[s] = 1 -    else: -        d[s] += 1 -ans = Counter(d).most_common() -ans.sort(key=lambda x: (-x[1], x[0])) -m = ans[0][1] -for i in ans: -    if i[1] != m: -        break -    print((i[0])) +# from operator import itemgetter,mul +# from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations +from sys import stdin, setrecursionlimit + +# from bisect import bisect_left,bisect_right +# from copy import deepcopy +# import heapq +# import math +# import string +# from time import time +# from functools import lru_cache,reduce +# from math import factorial,hypot +# import sys +# from fractions import gcd +setrecursionlimit(10**6) +input = stdin.readline + + +def main(): +    n = int(input().rstrip()) +    d = dict() +    for _ in range(n): +        s = input().rstrip() +        if s not in d: +            d[s] = 1 +        else: +            d[s] += 1 +    ans = Counter(d).most_common() +    ans.sort(key=lambda x: (-x[1], x[0])) +    ma = ans[0][1] +    for i in ans: +        if i[1] != ma: +            break +        print((i[0])) + + +if __name__ == "__main__": +    main()