member = [] for _ in range(int(input())): a, b = map(int, input().split()) member.append([a, b]) item = [] for _ in range(int(input())): a, b = map(int, input().split()) item.append([a, b, 0]) max = 0 for [a, b] in member: for i in range(len(item)): x, y, z = item[i] if a >= x and b <= y: item[i] = [x, y, z + 1] if max < z + 1: max = z + 1 count = 0 for i in range(len(item)): x, y, z = item[i] if z == max: print(i + 1)