import Control.Monad

type Pos = (Int, Int)

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine :: IO [Int]
  ss <- map (map read . words) <$> replicateM n getLine :: IO [[Int]]
  ps <- map (map read . words) <$> replicateM m getLine :: IO [[Int]]
  let students = [(x,y) | s <- ss, let (x,y) = (head s, last s)]
  let points = [(x,y) | s <- ps, let (x,y) = (head s, last s)]
  forM_ students (\s -> print $ minDistPos s points (manhattan s (head points)) 0)

minDistPos :: Pos -> [Pos] -> Int -> Int ->  Int
minDistPos _ [] _ acc = acc
minDistPos stu (pt:pts) prev acc =
 let m = manhattan stu pt
  in if m >= prev then 
                  minDistPos stu pts m acc
                  else
                  minDistPos stu pts m (acc+1)      
  

manhattan :: Pos -> Pos -> Int
manhattan (x1,y1) (x2,y2) =
  abs (x1-x2) + abs (y1-y2)
