module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Array
import           Data.Char

main = do
  [n, m] <- map (read :: String -> Int) . words <$> getLine
  coords1 <- forM [1..n] (\i -> (\[x, y] -> (x, y)) . map (read :: String -> Int) . words <$> getLine)
  coords2 <- zip [1..m] <$> forM [1..m] (\i -> (\[x, y] -> (x, y)) . map (read :: String -> Int) . words <$> getLine)
  forM_ coords1 (\t -> print $ calcNearest t coords2)

calcNearest::(Int, Int) -> [(Int, (Int, Int))] -> Int
calcNearest (a, b) coords = snd . minimum $ map (\(index, (x, y)) -> (abs (x - a) + abs (y - b), index)) coords