import Control.Monad
import Data.List

{-
2 2
2 0
0 0
-1 0
1 0
-}

main :: IO ()
main = do
  [n, m] <- getInts
  as <- replicateM n getPairInt
  bs <- replicateM m getPairInt
  mapM_ print $ solve as $ zip [1..] bs

getInts :: IO [Int]
getInts = map read . words <$> getLine

getPairInt :: IO (Int, Int)
getPairInt = do
  [a, b] <- getInts
  return (a, b)

solve :: [(Int, Int)] -> [(Int, (Int, Int))] -> [Int]
solve [] _ = []
solve (s:ss) ts = (getMin s) : solve ss ts
  where
    getMin :: (Int, Int) -> Int
    getMin student = (fst . head) $ sortBy (\a b ->
                      compare (snd a) (snd b))$ map (calcDist student) ts
    calcDist (ax, ay) (idNum, (bx, by)) =
      (idNum, (abs (ax - bx)) + (abs (ay - by)))
