defmodule Main do
  def main do 
    [n, m] =
      IO.gets("")
      |> String.trim()
      |> String.split()
      |> Enum.map(&String.to_integer/1)
      
    ab = 
      IO.stream(:stdio, :line)
      |> Enum.take(n)
      |> Enum.map(&String.trim/1)
      |> Enum.map(&String.split/1)
      |> Enum.map(&Enum.map(&1, fn elem ->
        String.to_integer(elem)
      end))
      
    cd = 
      IO.stream(:stdio, :line)
      |> Enum.take(n)
      |> Enum.map(&String.trim/1)
      |> Enum.map(&String.split/1)
      |> Enum.map(&Enum.map(&1, fn elem ->
        String.to_integer(elem)
      end))
      |> Enum.with_index(1)
      
    process(ab, cd)
  end
  
  def process([], _), do: []
  def process([head | tail], cd) do
    _process(head, cd, 1000000001, 0)
    process(tail, cd)
  end
    
  def _process(_, [], min, min_num), do: IO.puts(min_num)
  def _process([a, b], [{[c, d], index} | tail], min, min_index) do
    manhatan = manhatan([a, b], [c, d])
    case manhatan < min do
      true -> _process([a, b], tail, manhatan, index)
      false -> _process([a, b], tail, min, min_index)
    end
  end
  
  def manhatan([a, b], [c, d]), do: abs(a-c) + abs(b-d)
end
