n=int(eval(input()))

a=[0]*-~n;b=[0]*-~n

mx=-1

mi=-1

for i in range(n):

  a[i], b[i] = list(map(int,input().split()))

  if a[i] > mx:

    mx = a[i]; mi = i



print((mx+b[mi]))
n = int(eval(input()))

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



ab.sort()

ans = ab[0][0] + ab[n - 1][1] + (ab[n - 1][0] - ab[0][0])

print(ans)

n = int(eval(input()))
a = [0] * -~n
b = [0] * -~n
mx = -1
mi = -1
for i in range(n):
    a[i], b[i] = list(map(int, input().split()))
    if a[i] > mx:
        mx = a[i]
        mi = i
print((mx + b[mi]))

n = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
ans = ab[0][0] + ab[n - 1][1] + (ab[n - 1][0] - ab[0][0])
print(ans)

-a = [0] * -~n -b = [0] * -~n -mx = -1 -mi = -1 -for i in range(n): -    a[i], b[i] = list(map(int, input().split())) -    if a[i] > mx: -        mx = a[i] -        mi = i -print((mx + b[mi])) +ab = [tuple(map(int, input().split())) for _ in range(n)] +ab.sort() +ans = ab[0][0] + ab[n - 1][1] + (ab[n - 1][0] - ab[0][0]) +print(ans)