def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    import collections
    counter = collections.Counter(S)
    answers = []
    maxcnt = 0
    for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
    [print(s) for s in sorted(answers)]

if '__main__' == __name__:
    resolve() def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    import collections
    counter = collections.Counter(S)
    answers = []
    maxcnt = 0
    for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
    [print(s) for s in sorted(answers)] resolve N = int(input()) N int(input()) int input() input input() for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) input() input S = [input() for _ in range(N)] S [input() for _ in range(N)] import collections collections counter = collections.Counter(S) counter collections.Counter(S) collections.Counter collections Counter S answers = [] answers [] maxcnt = 0 maxcnt 0 for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
     k v counter.items() counter.items counter items if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
     maxcnt < v maxcnt v maxcnt = v maxcnt v answers = [k] answers [k] k elif maxcnt == v:
            answers.append(k)
     maxcnt == v maxcnt v answers.append(k) answers.append answers append k print(s) for s in sorted(answers) for s in sorted(answers) s sorted(answers) sorted answers for s in sorted(answers) print(s) print s [print(s) for s in sorted(answers)] if '__main__' == __name__:
    resolve() '__main__' == __name__ '__main__' __name__ resolve() resolve def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    import collections
    counter = collections.Counter(S)
    answers = []
    maxcnt = 0
    for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
    [print(s) for s in sorted(answers)] def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    import collections
    counter = collections.Counter(S)
    answers = []
    maxcnt = 0
    for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
    [print(s) for s in sorted(answers)] resolve
def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    import collections
    counter = collections.Counter(S)
    answers = []
    maxcnt = 0
    for k, v in counter.items():
        if maxcnt < v:
            maxcnt = v
            answers = [k]
        elif maxcnt == v:
            answers.append(k)
    [print(s) for s in sorted(answers)]

if '__main__' == __name__:
    resolve()