N = int(input()) AB = [list(map(int, input().split())) for _ in range(N)] M = int(input()) XY = [list(map(int, input().split())) for _ in range(M)] counts = [0 for _ in range(M)] for i in range(N): for j in range(M): if AB[i][0] >= XY[j][0] and AB[i][1] <= XY[j][1]: counts[j] += 1 print(counts.index(max(counts)) + 1 if counts.index(max(counts)) != 0 else 0)