nm = gets.chomp.split.map {|s| s.to_i }
s = Array.new(nm[0]) do |i|
  gets.chomp.split.map {|s| s.to_i }
end
d = Array.new(nm[1]) do |i|
  gets.chomp.split.map {|s| s.to_i }
end
s.each do |e|
  m = 100000000000
  res = 0
  d.each_with_index do |x, idx|
    res = idx if ((e[0]-x[0]).abs + (e[1]-x[1]).abs) < ((e[0]-d[res][0]).abs + (e[1]-d[res][1]).abs)
  end
  puts res
end