N = int(input().strip()) A, B = [], [] for i in range(N): tmp = list(map(int, input().split())) A.append(tmp[0]) B.append(tmp[1]) M = int(input().strip()) X, Y = [], [] for i in range(M): tmp = list(map(int, input().split())) X.append(tmp[0]) Y.append(tmp[1]) lst = [0] * M for n in range(len(X)): x, y = X[n], Y[n] for a, b in zip(A, B): if x <= a and y >= b: lst[n] += 1 m = max(lst) for n, i in enumerate(lst): if i == m and m > 0: print(n+1)