let read_array n = Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun x y -> x, y))

let md (x1, y1) (x2, y2) = abs (x1 - x2) + abs (y1 - y2)

let ans n m ab cd =
  let rec solve i =
    if i < n then
      let abi = ab.(i) in
      let rec f j d ret =
        if j = m then ret
        else
          let t = md abi cd.(j) in
          if t < d then f (j + 1) t (j + 1)
          else f (j + 1) d ret
      in (Printf.printf "%d\n" (f 0 1000000000 0); solve (i + 1))
  in solve 0

let () =
  let n, m = Scanf.scanf "%d %d\n" (fun n m -> n, m) in
  let ab = read_array n
  and cd = read_array m in
  ans n m ab cd
