# 0028

array = []

while True:

    try:

        a = eval(input())

        array.append(int(a))

    except EOFError:

        break

s = set(array)

mx = array.count(max(s, key = array.count))

for a in sorted(s):

    if array.count(a) == mx:

        print(a)
# 0028

array = []

while True:

    try:

        a = eval(input())

        array.append(int(a))

    except EOFError: break

s = set(array)

mx = max(sorted(s, reverse=True), key = array.count)

for a in sorted(s, key = array.count, reverse=True):

    print(a)

    if a == mx: break
# 0028
array = []
while True:
    try:
        a = eval(input())
        array.append(int(a))
    except EOFError:
        break
s = set(array)
mx = array.count(max(s, key=array.count))
for a in sorted(s):
    if array.count(a) == mx:
        print(a)

# 0028
array = []
while True:
    try:
        a = eval(input())
        array.append(int(a))
    except EOFError:
        break
s = set(array)
mx = max(sorted(s, reverse=True), key=array.count)
for a in sorted(s, key=array.count, reverse=True):
    print(a)
    if a == mx:
        break

-mx = array.count(max(s, key=array.count)) -for a in sorted(s): -    if array.count(a) == mx: -        print(a) +mx = max(sorted(s, reverse=True), key=array.count) +for a in sorted(s, key=array.count, reverse=True): +    print(a) +    if a == mx: +        break