(* O(n m) *)
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 md (x1, y1) (x2, y2) = abs (x1 - x2) + abs (y1 - y2)
let _ =
  for i = 0 to n - 1 do
    let d = ref max_int in
    let c = ref 0 in
    for j = 0 to m - 1 do
      let nd = md ab_s.(i) cds.(j) in
      if nd < !d then (d := nd; c := j + 1)
    done;
    Printf.printf "%d\n" !c
  done