a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
g = int(input())

x = [a, b, c, d, e, f, g]

x_sort = sorted(x)

print(x_sort[6])
print(x_sort[5])



