N = int(eval(input()))

A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])

a = A[-1][0]

b = A[-1][1]

print((a+b))
N = int(eval(input()))

A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])

a,b = A[-1]

print((a+b))
N = int(eval(input()))
A = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
a = A[-1][0]
b = A[-1][1]
print((a + b))

N = int(eval(input()))
A = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
a, b = A[-1]
print((a + b))

-a = A[-1][0] -b = A[-1][1] +a, b = A[-1]