let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ab_s = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let cds = Array.init m @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a, b
let f (a, b) = let m = ref (max_int, -1) in Array.iteri (fun i (c, d) -> m := min !m @@ (abs (a - c) + abs (b - d), i + 1)) cds; Printf.printf "%d\n" @@ snd !m
let _ = Array.iter f ab_s