# P, Q, R = map(int, input().split())

S = list(map(int, input().split()))



hoge = S.pop(S.index(min(S)))

fuga = S.pop(S.index(min(S)))



print((hoge + fuga))

distances = list(map(int, input().split()))



distances.sort()



print((distances[0]+distances[1]))

# P, Q, R = map(int, input().split())
S = list(map(int, input().split()))
hoge = S.pop(S.index(min(S)))
fuga = S.pop(S.index(min(S)))
print((hoge + fuga))

distances = list(map(int, input().split()))
distances.sort()
print((distances[0] + distances[1]))

-# P, Q, R = map(int, input().split()) -S = list(map(int, input().split())) -hoge = S.pop(S.index(min(S))) -fuga = S.pop(S.index(min(S))) -print((hoge + fuga)) +distances = list(map(int, input().split())) +distances.sort() +print((distances[0] + distances[1]))