import Control.Monad
dist a b c d = abs(a-c)+abs(b-d)

main = do
  [n,m] <- map read.words <$> getLine 
  ab <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  cd <- replicateM m $ map read . words <$> getLine :: IO [[Int]]
  sequence $  do 
    [a,b] <- ab
    return $ print $ snd $ minimum $  do 
      ([c,d],i) <- zip cd [1..]
      return (dist a b c d,i)
    
