import sys

from collections import Counter



input = sys.stdin.readline





def main():

    N = int(input())

    S = [""] * N

    for i in range(N):

        S[i] = input().rstrip()



    c = Counter(S)

    max_v = max(c.values())

    ans = [k for k, v in c.items() if v == max_v]

    ans.sort()



    print(*ans, sep="\n")





if __name__ == "__main__":

    main()

import sys

from collections import Counter



input = sys.stdin.readline





def main():

    N = int(eval(input()))

    S = [""] * N

    for i in range(N):

        S[i] = input().rstrip()



    c = Counter(S)

    max_v = max(c.values())

    ans = [k for k, v in list(c.items()) if v == max_v]

    ans.sort()



    print(("\n".join(ans)))





if __name__ == "__main__":

    main()

import sys
from collections import Counter

input = sys.stdin.readline


def main():
    N = int(input())
    S = [""] * N
    for i in range(N):
        S[i] = input().rstrip()
    c = Counter(S)
    max_v = max(c.values())
    ans = [k for k, v in c.items() if v == max_v]
    ans.sort()
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

import sys
from collections import Counter

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    S = [""] * N
    for i in range(N):
        S[i] = input().rstrip()
    c = Counter(S)
    max_v = max(c.values())
    ans = [k for k, v in list(c.items()) if v == max_v]
    ans.sort()
    print(("\n".join(ans)))


if __name__ == "__main__":
    main()

-    N = int(input()) +    N = int(eval(input())) -    ans = [k for k, v in c.items() if v == max_v] +    ans = [k for k, v in list(c.items()) if v == max_v] -    print(*ans, sep="\n") +    print(("\n".join(ans)))