N = int(input())
a = dict()
m = 0
n = 0
for i in range(N):
    x = int(input())
    if x in a.keys():
        a[x] += 1
    else:
        a[x] = 1
sdict = sorted(a.items())
for i, j in sdict:
    if j > m:
        n, m = i, j
print(n)

da18f3a8cc3fb3c691b1732553d770c672a87229
<mask token>

<mask token>
for i in range(N):
    x = int(input())
    if x in a.keys():
        a[x] += 1
    else:
        a[x] = 1
<mask token>
for i, j in sdict:
    if j > m:
        n, m = i, j
print(n)

N = int(input())
a = dict()
m = 0
n = 0
for i in range(N):
    x = int(input())
    if x in a.keys():
        a[x] += 1
    else:
        a[x] = 1
sdict = sorted(a.items())
for i, j in sdict:
    if j > m:
        n, m = i, j
print(n)
