import Control.Applicative ((<$>))
import Control.Monad (forM_)

main = do
  [n,m] <- map read.words <$> getLine :: IO [Int]
  coords <- map (map read.words).lines <$> getContents :: IO [[Int]]
  let ablist = take n coords
      cdlist = zip (drop n coords) [1..m]
  forM_ ablist $ \[a,b] -> do
    let (_,p) = minimum [(abs(a-head x)+abs(b-(head.tail)x),i)|(x,i)<-cdlist]
    print p
