n = int(input()) ab = [list(map(int,input().split())) for _ in range(n)] m = int(input()) cnt = [0]*m for _ in range(m): x,y = map(int,input().split()) c = 0 for a,b in ab: if x <= a and y >= b: c += 1 cnt[_] = c v = max(cnt) for i in range(n): if cnt[i]==v: print(i+1)