scores = [list(map(int, input().split())) for _ in range(2)]

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

print((max(sum(map(int, input().split())), sum(map(int, input().split())))))

-scores = [list(map(int, input().split())) for _ in range(2)] -print((max(sum(scores[0]), sum(scores[1])))) +print((max(sum(map(int, input().split())), sum(map(int, input().split())))))