import collections

n = int(input())

dd = collections.defaultdict(int)

for _ in range(n):

    dd[input()] += 1

ans = []

for key in dd.keys():

    ans.append((dd[key], key))

ans.sort(reverse=True)

ans2 = [ans[0][1]]

for i in range(1, len(ans)):

    if ans[i - 1][0] != ans[i][0]:

        break

    ans2.append(ans[i][1])

ans2.sort()

print(*ans2, sep='\n')

import collections

n = int(input())

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

s = collections.Counter(s).most_common()

ans = []

for i in range(1, len(s) + 1):

    ans.append(s[i - 1][0])

    if i == len(s):

        break

    if s[i - 1][1] != s[i][1]:

        break

ans.sort()

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

import collections

n = int(input())
dd = collections.defaultdict(int)
for _ in range(n):
    dd[input()] += 1
ans = []
for key in dd.keys():
    ans.append((dd[key], key))
ans.sort(reverse=True)
ans2 = [ans[0][1]]
for i in range(1, len(ans)):
    if ans[i - 1][0] != ans[i][0]:
        break
    ans2.append(ans[i][1])
ans2.sort()
print(*ans2, sep="\n")

import collections

n = int(input())
s = [input() for _ in range(n)]
s = collections.Counter(s).most_common()
ans = []
for i in range(1, len(s) + 1):
    ans.append(s[i - 1][0])
    if i == len(s):
        break
    if s[i - 1][1] != s[i][1]:
        break
ans.sort()
print(*ans, sep="\n")

-dd = collections.defaultdict(int) -for _ in range(n): -    dd[input()] += 1 +s = [input() for _ in range(n)] +s = collections.Counter(s).most_common() -for key in dd.keys(): -    ans.append((dd[key], key)) -ans.sort(reverse=True) -ans2 = [ans[0][1]] -for i in range(1, len(ans)): -    if ans[i - 1][0] != ans[i][0]: +for i in range(1, len(s) + 1): +    ans.append(s[i - 1][0]) +    if i == len(s): -    ans2.append(ans[i][1]) -ans2.sort() -print(*ans2, sep="\n") +    if s[i - 1][1] != s[i][1]: +        break +ans.sort() +print(*ans, sep="\n")