N=int(input()) list1=[] for i in range(N): N=input() N=N.rstrip().split(" ") list1.append([int(N[0]),int(N[1])]) #print(list1) list2=[] M=int(input()) for j in range(M): M=input() M=M.rstrip().split(" ") list2.append([int(M[0]),int(M[1]),j+1]) #print(list2) i=0 j=0 list3=[] for i in range(len(list2)): list3.append([0,i+1]) #print(list3) i=0 for i in range(len(list1)): for j in range(len(list2)): #print(i,j) if list2[j][0]<=list1[i][0] and list2[j][1]>=list1[i][1]: list3[j][0]=list3[j][0]+1 #print(list3) list3.sort(reverse=True) if len(list3)==1: print(list3[0][0]) else: list4=[list3[0][1]] i=0 for i in range(1,len(list3)): if list3[0][0]==list3[i][0]: list4.append(list3[i][1]) list4.sort() for j in range(len(list4)): print(list4[j])