import           Control.Monad
import           Control.Applicative
import           Data.IORef
import           Data.List.Split
import           Data.Maybe
import           Data.List

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  sts <- replicateM n $ map read . words <$> getLine
  pts <- replicateM m $ map read . words <$> getLine

  forM_ sts $ \(sx:sy:_) -> do
    let ds = map (\(x:y:_) -> abs (sx - x) + abs (sy - y)) pts
    print $ 1 + (head . elemIndices (minimum ds)) ds