import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N = int(readline()) data = np.array(read().split(),np.int64) AB = data[:N+N] A = AB[::2] B = AB[1::2] XY = data[N+N+1:] X = XY[::2] Y = XY[1::2] count = np.array([np.count_nonzero((A >= x) & (B <= y)) for x,y in zip(X,Y)]) x = count.max() answer = np.where(count == x)[0] + 1 if x == 0: print(0) else: print('\n'.join(answer.astype(str)))