li = []
for i in xrange(10):
    s = map(str, raw_input().split())
    li.append(int(s[-1]))
li.sort(reverse=True)
for i in xrange(3):
    print li[i] li = [] li [] for i in xrange(10):
    s = map(str, raw_input().split())
    li.append(int(s[-1])) i xrange(10) xrange 10 s = map(str, raw_input().split()) s map(str, raw_input().split()) map str raw_input().split() ().split () raw_input split li.append(int(s[-1])) li.append li append int(s[-1]) int s[-1] s -1 li.sort(reverse=True) li.sort li sort reverse=True reverse True for i in xrange(3):
    print li[i] i xrange(3) xrange 3 print li[i] li i s = map(str, raw_input().split()) map(str, raw_input().split()) s li = [] [] li
li = []
for i in xrange(10):
    s = map(str, raw_input().split())
    li.append(int(s[-1]))
li.sort(reverse=True)
for i in xrange(3):
    print li[i]