import Data.List
import Data.Ord
import Data.Function
import Data.Maybe
import Control.Monad

main = do
    [n,m] <- map read . words <$> getLine
    ps <- tuplify . map read . concatMap words <$> replicateM n getLine :: IO [(Int,Int)]
    cs <- tuplify . map read . concatMap words <$> replicateM m getLine :: IO [(Int,Int)]
    let solve (a,b) = (+1) . minimumIndex $ map (\(ca,cb) -> ((+) `on` abs) (ca - a) (cb - b)) cs
    mapM_ print $ map solve ps
    where
        minimumIndex xs = maybe (-1) id . flip elemIndex xs $ minimum xs

tuplify [] = []
tuplify (x:y:xs) = (x,y):tuplify xs
