N = int(input()) a = [0 for i in range(N)] b = [0 for i in range(N)] for i in range(N): a[i], b[i] = list(map(int, input().split())) M = int(input()) x = [0 for i in range(M)] y = [0 for i in range(M)] for i in range(M): x[i], y[i] = list(map(int, input().split())) cnt = [0 for i in range(M)] for i in range(N): for j in range(M): if x[j] <= a[i] and y[j] >= b[i]: cnt[j] += 1 ma = 0 for i in range(M): ma = max(ma, cnt[i]) ans = [] for i in range(M): if ma == cnt[i]: ans.append(i) for idx in ans: print(idx + 1)