let () =
  let n,m = Scanf.scanf "%d %d " (fun a b -> a,b) in
  let ab_lst = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d %d " (fun a b -> a,b)) in
  let cd_lst = Array.to_list @@ Array.init m (fun i -> Scanf.scanf "%d %d " (fun a b -> (i+1,(a,b)))) in

  let tmp = List.map (fun (a,b) -> 
      let l = List.map (fun (i,(c,d)) -> (i, ((abs @@ c-a) + (abs @@ d-b)))) cd_lst |>
              List.stable_sort (fun (i1,d1) (i2,d2) -> compare d1 d2) 
      in 
      let (i,_) = List.hd l in i
    ) ab_lst
  in
  List.iter (fun x -> Printf.printf "%d\n" x) tmp
