import Control.Monad
type Coord = (Int, Int)

main:: IO ()
main = do
    [n,m] <- readLine <$> getLine
    s1s <- replicateM n getLine
    s2s <- replicateM m getLine
    let as = map readLine2 s1s
    let cs = map readLine2 s2s
    mapM_ print $ solve m cs as

solve :: Int -> [Coord] -> [Coord] -> [Int]
solve m cs = map (nearest m cs)

nearest :: Int -> [Coord] -> Coord -> Int
nearest m cs ab = fst $ foldl f (0,100000) (zip [1..m] ds)
    where
        ds = [dist ab cd | cd <- cs]
        f (j',d') (j, d) = if d < d' then (j,d) else (j',d')

readLine :: String -> [Int]
readLine = map read . words

readLine2 :: String -> (Int,Int)
readLine2 = tuplify2 . map read . words

tuplify2 :: [a] -> (a,a)
tuplify2 (x:y:_) = (x,y)

dist :: Coord -> Coord -> Int
dist (x1,y1) (x2,y2) = abs (x1-x2) + abs (y1-y2)
