import Control.Monad
import Data.List
g = (\[a,b] [c,d] -> (abs (a-c))+(abs(b-d))) 
f a c=if null a then [] else [head(elemIndices ((minimum.map (g (head a))) c) (map (g (head a)) c))]++f(tail a)c
main=do
 [n,m]<-map read.words<$>getLine
 a<-map (map read).map words<$>replicateM n getLine
 c<-map (map read).map words<$>replicateM m getLine
 putStrLn$init$unlines$map (show.(+1))$f a c