n = int(input()) ab = [] for i in range(n): a, b = map(int, input().split()) ab.append([a, b]) m = int(input()) xy = [] for i in range(m): x, y = map(int, input().split()) xy.append([x,y]) c = [0 for i in range(m)] for i in range(n): for j in range(m): if xy[j][0] <= ab[i][0] and xy[j][1] >= ab[i][1]: c[j] += 1 #print (c) mx = max(c) if mx == 0: print (0) exit() for i, j in enumerate(c): if mx == j: print (i+1)