let dist a b c d = abs(a-c)+abs(b-d) in
Scanf.scanf "%d %d " @@ fun n m ->
  let a = Array.make n 0 in
  let b = Array.make n 0 in
  for i=0 to n-1 do
    Scanf.scanf "%d %d " @@ fun ai bi ->
      a.(i) <- ai;
      b.(i) <- bi
  done;
  let c = Array.make m 0 in
  let d = Array.make m 0 in
  for j=0 to m-1 do
    Scanf.scanf "%d %d " @@ fun cj dj ->
      c.(j) <- cj;
      d.(j) <- dj
  done;
  for i=0 to n-1 do
    let min = ref max_int in 
    let index = ref 0 in
    for j=0 to m-1 do
      let distance = dist a.(i) b.(i) c.(j) d.(j) in 
      if !min > distance then (
        min := distance; index := j
      )
    done;
    Printf.printf "%d\n" (!index+1)
  done
