import Control.Monad
import Data.Array.IO
import Data.IORef
dist a b c d = abs(a-c)+abs(b-d)
 
main = do
  [n,m] <- map read.words <$> getLine
  a <- newArray (1,n) 0 :: IO ( IOArray Int Int )
  b <- newArray (1,n) 0 :: IO ( IOArray Int Int )
  c <- newArray (1,m) 0 :: IO ( IOArray Int Int )
  d <- newArray (1,m) 0 :: IO ( IOArray Int Int )
  forM [1..n] $ (\i -> do 
    [ai,bi] <- map read . words <$> getLine
    writeArray a i ai
    writeArray b i bi
    return () )
  forM [1..m] $ (\j -> do 
    [cj,dj] <- map read . words <$> getLine
    writeArray c j cj
    writeArray d j dj
    return () )
  forM [1..n] $ ( \i -> do
    rmin <- newIORef (maxBound :: Int)
    rindex <- newIORef 0
    forM [1..m] $ ( \j -> do
      distance <- dist <$> (readArray a i) <*> (readArray b i) <*>(readArray c j) <*> (readArray d j)
      min <- readIORef rmin
      if min > distance then do
        writeIORef rmin distance
        writeIORef rindex j 
      else
        return () )
    (readIORef rindex) >>= print )