ab=[list(map(int,input().split())) for i in range(int(input()))] xy=[list(map(int,input().split()))+[0,i+1] for i in range(int(input()))] #print(ab) #print(xy) for w in ab: for v in xy: if w[0]>=v[0] and w[1]<=v[1]: v[2]+=1 mv=max([v[2] for v in xy]) if mv==0: print(0) exit() xy.sort(key=lambda x:x[2],reverse=True) counter=0 while True: try: if xy[counter][2]==mv: print(xy[counter][3]) counter+=1 else: break except: break