N = int(input())

d = {}

mv = 0

mfw = []

for _ in range(N):

    w = input()

    d[w] = d.get(w, 0) + 1

    if d[w] > mv:

        mv += 1

        mfw.clear()

        mfw.append(w)

    elif d[w] == mv:

        mfw.append(w)

[print(w) for w in sorted(mfw)]

from collections import Counter



N = int(input())

c = Counter([input() for _ in range(N)])

mv = max(c.values())

[print(w) for w in sorted(c.keys()) if c[w] == mv]

N = int(input())
d = {}
mv = 0
mfw = []
for _ in range(N):
    w = input()
    d[w] = d.get(w, 0) + 1
    if d[w] > mv:
        mv += 1
        mfw.clear()
        mfw.append(w)
    elif d[w] == mv:
        mfw.append(w)
[print(w) for w in sorted(mfw)]

from collections import Counter

N = int(input())
c = Counter([input() for _ in range(N)])
mv = max(c.values())
[print(w) for w in sorted(c.keys()) if c[w] == mv]

+from collections import Counter + -d = {} -mv = 0 -mfw = [] -for _ in range(N): -    w = input() -    d[w] = d.get(w, 0) + 1 -    if d[w] > mv: -        mv += 1 -        mfw.clear() -        mfw.append(w) -    elif d[w] == mv: -        mfw.append(w) -[print(w) for w in sorted(mfw)] +c = Counter([input() for _ in range(N)]) +mv = max(c.values()) +[print(w) for w in sorted(c.keys()) if c[w] == mv]