n = int(eval(input()))

M = [tuple(map(int, input().split()))for _ in range(n)]

a, b = -1, -1

for i in range(n):

    ta, tb = M[i]

    if ta > a:

        a = ta

        b = tb

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

a, b = 0, float('inf')

for i in range(n):

    ta, tb = list(map(int, input().split()))

    if a < ta:

        a = ta

        b = tb



print((a + b))
n = int(eval(input()))
M = [tuple(map(int, input().split())) for _ in range(n)]
a, b = -1, -1
for i in range(n):
    ta, tb = M[i]
    if ta > a:
        a = ta
        b = tb
print((a + b))

n = int(eval(input()))
a, b = 0, float("inf")
for i in range(n):
    ta, tb = list(map(int, input().split()))
    if a < ta:
        a = ta
        b = tb
print((a + b))

-M = [tuple(map(int, input().split())) for _ in range(n)] -a, b = -1, -1 +a, b = 0, float("inf") -    ta, tb = M[i] -    if ta > a: +    ta, tb = list(map(int, input().split())) +    if a < ta: