from operator import add



n = int(eval(input()))

print((min(add(*list(map(int, input().split()))) for _ in range(n))))

print((min(sum(map(int,input().split()))for _ in range(int(eval(input()))))))

from operator import add

n = int(eval(input()))
print((min(add(*list(map(int, input().split()))) for _ in range(n))))

print((min(sum(map(int, input().split())) for _ in range(int(eval(input()))))))

-from operator import add - -n = int(eval(input())) -print((min(add(*list(map(int, input().split()))) for _ in range(n)))) +print((min(sum(map(int, input().split())) for _ in range(int(eval(input()))))))