import Control.Monad

main = do
  li <- getLine
  let [n,m] = map read $ words li
  abs <- forM [1..n] (\_ -> do
    li <- getLine
    let [a,b] = map read $ words li
    return (a,b)
    )
  cds <- forM [1..m] (\_ -> do
    li <- getLine
    let [c,d] = map read $ words li
    return (c,d)
    )
  let ans = compute abs cds
  mapM_ print ans

compute :: [(Int,Int)] -> [(Int,Int)] -> [Int]
compute abs cds = map (nearest cds) abs

nearest :: [(Int,Int)] -> (Int,Int) -> Int
nearest cds ab = snd $ minimum [ (mdis ab cd, j) | (cd,j) <- zip cds [1..] ]

mdis :: (Int,Int) -> (Int,Int) -> Int
mdis (a,b) (c,d) = abs (a-c) + abs (b-d)
