N = int(input()) ABs = [[int(j) for j in input().split()] for i in range(N)] M = int(input()) XYs = [[int(j) for j in input().split()] for i in range(M)] def be_wanted(A, B, X, Y): if X <= A and B <= Y: return True else: return False def argmax_s(X): tmp = -99999 ind = -1 for i, x in enumerate(X): if tmp < x: tmp = x ind = i return [i for i in range(len(X)) if X[i] == tmp] point = [0 for i in range(M)] for i, xy in enumerate(XYs): for ab in ABs: if be_wanted(ab[0], ab[1], xy[0], xy[1]): point[i] += 1 gen = [i for i, xy in enumerate(XYs) for ab in ABs if be_wanted(ab[0], ab[1], xy[0], xy[1])] point = [gen.count(i) for i in range(M)] if sum(point) == 0: print(0) else: for i in (argmax_s(point)): print(i+1)