let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let abs_ = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
  let cds = Array.init m @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun c d -> c, d in
  Array.iter (fun (a, b) ->
    Array.init m (fun i -> i)
    |> Array.fold_left (fun j i ->
        if abs (a - fst cds.(i)) + abs (b - snd cds.(i)) < abs (a - fst cds.(j)) + abs (b - snd cds.(j)) then i
        else j) 0
    |> ( + ) 1
    |> Printf.printf "%d\n") abs_
