# coding: utf-8
from collections import defaultdict


def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break


if __name__ == "__main__":
    main() from collections import defaultdict def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break main N = int(input()) N int(input()) int input() input dic = defaultdict(int) dic defaultdict(int) defaultdict int max_p = 0 max_p 0 for i in range(N):
        dic[input()] += 1

     i range(N) range N dic[input()] += 1 dic[input()] dic input() input 1 d = dict(dic) d dict(dic) dict dic l = [] l [] for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
     key value d.items() d.items d items l.append([key, value]) l.append l append [key, value] key value if max_p < value: max_p = value
    
     max_p < value max_p value l.sort(key=lambda x: (-x[1], x[0]), reverse=False) l.sort l sort key=lambda x: (-x[1], x[0]) key lambda x: (-x[1], x[0]) (-x[1], x[0]) -x[1] x[1] x 1 x[0] x 0 x reverse=False reverse False for i, j in l:
        if j == max_p:
            print(i)
        else:
            break i j l if j == max_p:
            print(i)
        else:
            break j == max_p j max_p print(i) print i break if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break main
# coding: utf-8
from collections import defaultdict


def main():
    N = int(input())
    dic = defaultdict(int)
    max_p = 0

    for i in range(N):
        dic[input()] += 1

    d = dict(dic)
    l = []

    for key, value in d.items():
        l.append([key, value])
        if max_p < value: max_p = value
    
    l.sort(key=lambda x: (-x[1], x[0]), reverse=False)

    for i, j in l:
        if j == max_p:
            print(i)
        else:
            break


if __name__ == "__main__":
    main()
