import numpy as np n = int(input()) A, B = map(np.array, zip(*(map(int, input().split()) for _ in range(n)))) m = max(B[A