import Control.Monad
import Data.Maybe (fromJust)
import Data.List (elemIndex)

type Pos = (Int, Int)

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine :: IO [Int]
  ss <- map (map read . words) <$> replicateM n getLine :: IO [[Int]]
  ps <- map (map read . words) <$> replicateM m getLine :: IO [[Int]]
  let students = [(x,y) | s <- ss, let (x,y) = (head s, last s)]
  let points = [(x,y) | s <- ps, let (x,y) = (head s, last s)]
  let distances points st =  [man | pt <- points, let man = manhattan st pt]
  forM_ students (print . (+1) . minsInd . distances points)
  
manhattan :: Pos -> Pos -> Int
manhattan (x1,y1) (x2,y2) =
  abs (x1-x2) + abs (y1-y2)

minsInd :: [Int] -> Int
minsInd ns = fromJust $ elemIndex m ns 
  where m = minimum ns
