import sys

read = sys.stdin.read



N, *AB = list(map(int, read().split()))

AB = list(sorted(zip(*[iter(AB)] * 2)))

print((sum(AB[-1])))
import sys

read = sys.stdin.read



N, *AB = list(map(int, read().split()))

AB = max(list(zip(*[iter(AB)] * 2)))

print((sum(AB)))
import sys

read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = list(sorted(zip(*[iter(AB)] * 2)))
print((sum(AB[-1])))

import sys

read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = max(list(zip(*[iter(AB)] * 2)))
print((sum(AB)))

-AB = list(sorted(zip(*[iter(AB)] * 2))) -print((sum(AB[-1]))) +AB = max(list(zip(*[iter(AB)] * 2))) +print((sum(AB)))