import Data.List
import Control.Monad

sndeq (_,y1) (_,y2) = y1 == y2
pair [a,b] = (a,b)

main = do
 [n,m] <- map read . words <$> getLine
 abs <- map (pair . map read . words) <$> replicateM n getLine
 cds <- map (pair . map read . words) <$> replicateM m getLine
 let icds = nubBy sndeq (zip [1..m] cds)
 mapM_ (print . checkpoint icds) abs

checkpoint icds (a,b) = fst $ minimumBy (closest (a,b)) icds

closest ab (_,cd1) (_,cd2) = compare (manhattan ab cd1) (manhattan ab cd2) 

manhattan (x1,y1) (x2,y2) = abs (x1-x2) + abs (y1-y2)