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)

    ans = []

    prev_v = 0

    for k, v in c.most_common():

        if prev_v == 0:

            prev_v = v

        else:

            if prev_v != v:

                break

        ans.append(k)



    ans.sort()

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





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)

    ans = []

    max_v = max(c.values())

    for k, v in c.items():

        if v == max_v:

            ans.append(k)



    ans.sort()

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





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)
    ans = []
    prev_v = 0
    for k, v in c.most_common():
        if prev_v == 0:
            prev_v = v
        else:
            if prev_v != v:
                break
        ans.append(k)
    ans.sort()
    print(*ans, sep="\n")


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)
    ans = []
    max_v = max(c.values())
    for k, v in c.items():
        if v == max_v:
            ans.append(k)
    ans.sort()
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

-    prev_v = 0 -    for k, v in c.most_common(): -        if prev_v == 0: -            prev_v = v -        else: -            if prev_v != v: -                break -        ans.append(k) +    max_v = max(c.values()) +    for k, v in c.items(): +        if v == max_v: +            ans.append(k)