import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Monad.ST
import Data.List
import Data.Maybe (fromJust)


data Point = Point { x::Int, y::Int } deriving Show
type Student = Point
data CheckPoint = CheckPoint { identifier :: Int, point :: Point }

pointX :: CheckPoint -> Int
pointX = x . point

pointY :: CheckPoint -> Int
pointY = y . point


readIntLine :: IO [Int]
readIntLine = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine


toStudent :: [Int] -> Student
toStudent (x:y:_) = Point { x=x, y=y }


toPoint :: Int -> [Int] -> CheckPoint
toPoint idx (x:y:_) = CheckPoint { identifier=idx, point=Point{x=x,y=y} }


toPointList :: Int -> [[Int]] -> [CheckPoint]
toPointList _ [] = []
toPointList idx (x:xs) = (toPoint idx x):(toPointList (idx + 1) xs)


getNearestPoint :: [CheckPoint] -> Student -> Int -> Int -> Int
getNearestPoint [] _ _ minIdx = minIdx
getNearestPoint (p:ps) student minDistance minIdx = getNearestPoint ps student nextValue nextIdx
    where
        d = abs((pointX p) - (x student)) + abs((pointY p) - (y student))
        nextValue = min d minDistance
        nextIdx = if (d < minDistance) then (identifier p) else minIdx


solve :: [CheckPoint] -> [Student] -> [Int]
solve _ [] = []
solve points (s:ss)
    = (getNearestPoint points s  1000000000 0):(solve points ss)

main :: IO ()
main = do
    (n:m:_) <- readIntLine
    ab <- replicateM n readIntLine
    c <- replicateM m readIntLine
    let students = map toStudent ab
        points = toPointList 1 c
        ans = solve points students
    forM_ ans print
