open System let read1() = Console.ReadLine() |> int let read2() = let t = Console.ReadLine().Split() |> Array.map (int) in (t.[0],t.[1]) let N = read1() let AB = Array.init N (fun _ -> read2()) let M = read1() let XY = Array.init M (fun _ -> read2()) |> Array.indexed |> Array.map (fun (idx,tup) -> (idx+1,tup)) let buy = AB |> Array.map(fun (a,b) -> XY |> Array.where (fun (_,(x,y)) -> x<=a && b<=y) |> Array.map (fun (idx,_) -> idx)) |> Array.concat let cnts = buy |> Array.countBy (fun x -> x) let maxCnt = cnts |> Array.maxBy (fun (_,cnt) -> cnt) |> snd cnts |> Array.where (fun (_,cnt) -> cnt=maxCnt) |> Array.map (fun (n,_) -> n) |> Array.sort |> Array.iter (printfn "%i")