import Control.Monad
import Data.List
main = getLine >>= main' . map read . words
    where
        main' [n, m] = replicateM n getLine >>= main'' m . map (map read . words)
        main'' m xs = replicateM m getLine >>= mapM print . solve xs . map (map read . words)

solve :: [[Int]] -> [[Int]] -> [Int]
solve xs ys = [dist x $ zip [1..] ys | x <- xs]

dist :: [Int] -> [(Int, [Int])] -> Int
dist [a, b] = fst . foldl' ff (0, 2 * 100000000)
    where
        ff acc@(_, accd) (n, [c, d])
            | accd > dst = (n, dst)
            | otherwise = acc
            where
                dst = abs (a - c) + abs (b - d)
