from collections import defaultdict

n = int(input())

S = [input() for _ in range(n)]

d = defaultdict(int)

for s in S:

    d[s] += 1

m = max(d.values())

items = d.items()

a = sorted([c[0] for c in items if c[1] == m])

[print(i) for i in a]

from collections import Counter

def main():

    n = int(input())

    S = [input() for _ in range(n)]

    c = Counter(S).most_common()

    V = c[0][1]

    ans = [k for k, v in c if v == V]

    [print(a) for a in sorted(ans)]



if __name__ == '__main__':

    main()

from collections import defaultdict

n = int(input())
S = [input() for _ in range(n)]
d = defaultdict(int)
for s in S:
    d[s] += 1
m = max(d.values())
items = d.items()
a = sorted([c[0] for c in items if c[1] == m])
[print(i) for i in a]

from collections import Counter


def main():
    n = int(input())
    S = [input() for _ in range(n)]
    c = Counter(S).most_common()
    V = c[0][1]
    ans = [k for k, v in c if v == V]
    [print(a) for a in sorted(ans)]


if __name__ == "__main__":
    main()

-from collections import defaultdict +from collections import Counter -n = int(input()) -S = [input() for _ in range(n)] -d = defaultdict(int) -for s in S: -    d[s] += 1 -m = max(d.values()) -items = d.items() -a = sorted([c[0] for c in items if c[1] == m]) -[print(i) for i in a] + +def main(): +    n = int(input()) +    S = [input() for _ in range(n)] +    c = Counter(S).most_common() +    V = c[0][1] +    ans = [k for k, v in c if v == V] +    [print(a) for a in sorted(ans)] + + +if __name__ == "__main__": +    main()