a=[]

for i in range(0,10):
    a.append(input())
inp = list(map(int,a))

INP=[0,0,0,0,0,0,0,0,0,0]

for i in range(0,10):
    for j in range(i+1,10):
        if inp[i]<inp[j]:
            INP[j]+=1
        elif inp[i]>inp[j]:
            INP[i]+=1
        else:
            INP[i]+=1
            INP[j]+=1

z = 0

for i in range(9,-1,-1):
    if z >= 3:
        break
    for j in range(0,10):
        if i == INP[j]:
            print(inp[j])
            z+=1
        if z >= 3:
            break a=[] a [] for i in range(0,10):
    a.append(input()) i range(0,10) range 0 10 a.append(input()) a.append a append input() input inp = list(map(int,a)) inp list(map(int,a)) list map(int,a) map int a INP=[0,0,0,0,0,0,0,0,0,0] INP [0,0,0,0,0,0,0,0,0,0] 0 0 0 0 0 0 0 0 0 0 for i in range(0,10):
    for j in range(i+1,10):
        if inp[i]<inp[j]:
            INP[j]+=1
        elif inp[i]>inp[j]:
            INP[i]+=1
        else:
            INP[i]+=1
            INP[j]+=1 i range(0,10) range 0 10 for j in range(i+1,10):
        if inp[i]<inp[j]:
            INP[j]+=1
        elif inp[i]>inp[j]:
            INP[i]+=1
        else:
            INP[i]+=1
            INP[j]+=1 j range(i+1,10) range i+1 i 1 10 if inp[i]<inp[j]:
            INP[j]+=1
        elif inp[i]>inp[j]:
            INP[i]+=1
        else:
            INP[i]+=1
            INP[j]+=1 inp[i]<inp[j] inp[i] inp i inp[j] inp j INP[j]+=1 INP[j] INP j 1 elif inp[i]>inp[j]:
            INP[i]+=1
         inp[i]>inp[j] inp[i] inp i inp[j] inp j INP[i]+=1 INP[i] INP i 1 INP[i]+=1 INP[i] INP i 1 INP[j]+=1 INP[j] INP j 1 z = 0 z 0 for i in range(9,-1,-1):
    if z >= 3:
        break
    for j in range(0,10):
        if i == INP[j]:
            print(inp[j])
            z+=1
        if z >= 3:
            break i range(9,-1,-1) range 9 -1 -1 if z >= 3:
        break
     z >= 3 z 3 break for j in range(0,10):
        if i == INP[j]:
            print(inp[j])
            z+=1
        if z >= 3:
            break j range(0,10) range 0 10 if i == INP[j]:
            print(inp[j])
            z+=1
         i == INP[j] i INP[j] INP j print(inp[j]) print inp[j] inp j z+=1 z 1 if z >= 3:
            break z >= 3 z 3 break INP=[0,0,0,0,0,0,0,0,0,0] [0,0,0,0,0,0,0,0,0,0] INP z = 0 0 z inp = list(map(int,a)) list(map(int,a)) inp a=[] [] a z+=1 1 z
a=[]

for i in range(0,10):
    a.append(input())
inp = list(map(int,a))

INP=[0,0,0,0,0,0,0,0,0,0]

for i in range(0,10):
    for j in range(i+1,10):
        if inp[i]<inp[j]:
            INP[j]+=1
        elif inp[i]>inp[j]:
            INP[i]+=1
        else:
            INP[i]+=1
            INP[j]+=1

z = 0

for i in range(9,-1,-1):
    if z >= 3:
        break
    for j in range(0,10):
        if i == INP[j]:
            print(inp[j])
            z+=1
        if z >= 3:
            break