import sys

readline = sys.stdin.readline

N = int(readline())

sn = {}

maxn = 0

for _ in range(N):

    S = readline()

    if S in sn:

        sn[S] += 1

    else:

        sn[S] = 0

    maxn = max(maxn, sn[S])

ans = sorted(s for s, n in sn.items() if n == maxn)

for s in ans:

    print(s, end="")

N = int(eval(input()))

x = {}

for _ in range(N):

    s = eval(input())

    if s in x:

        x[s] += 1

    else:

        x[s] = 1



maxcount = max(x.values())

ans = []

for s, count in list(x.items()):

    if count == maxcount:

        ans.append(s)

ans.sort()

for a in ans:

    print(a)
import sys

readline = sys.stdin.readline
N = int(readline())
sn = {}
maxn = 0
for _ in range(N):
    S = readline()
    if S in sn:
        sn[S] += 1
    else:
        sn[S] = 0
    maxn = max(maxn, sn[S])
ans = sorted(s for s, n in sn.items() if n == maxn)
for s in ans:
    print(s, end="")

N = int(eval(input()))
x = {}
for _ in range(N):
    s = eval(input())
    if s in x:
        x[s] += 1
    else:
        x[s] = 1
maxcount = max(x.values())
ans = []
for s, count in list(x.items()):
    if count == maxcount:
        ans.append(s)
ans.sort()
for a in ans:
    print(a)

-import sys - -readline = sys.stdin.readline -N = int(readline()) -sn = {} -maxn = 0 +N = int(eval(input())) +x = {} -    S = readline() -    if S in sn: -        sn[S] += 1 +    s = eval(input()) +    if s in x: +        x[s] += 1 -        sn[S] = 0 -    maxn = max(maxn, sn[S]) -ans = sorted(s for s, n in sn.items() if n == maxn) -for s in ans: -    print(s, end="") +        x[s] = 1 +maxcount = max(x.values()) +ans = [] +for s, count in list(x.items()): +    if count == maxcount: +        ans.append(s) +ans.sort() +for a in ans: +    print(a)