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

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

max_sum = max([sum(A), sum(B)])

print(max_sum)
A, B = [list(map(int, input().split())) for _ in range(2)]

print((max([sum(A), sum(B)])))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
max_sum = max([sum(A), sum(B)])
print(max_sum)

A, B = [list(map(int, input().split())) for _ in range(2)]
print((max([sum(A), sum(B)])))

-A = list(map(int, input().split())) -B = list(map(int, input().split())) -max_sum = max([sum(A), sum(B)]) -print(max_sum) +A, B = [list(map(int, input().split())) for _ in range(2)] +print((max([sum(A), sum(B)])))