# 数が少ないので、総当たりでよい
n, m = gets.chomp.split.map(&:to_i)
students = []
points = []
n.times do |i|
  students.push gets.chomp.split.map(&:to_i)
end
m.times do |i|
  points.push gets.chomp.split.map(&:to_i)
end

def cal_m_distance s: [nil, nil], p: [nil, nil]
  (s[0] - p[0]).abs + (s[1] - p[1]).abs
end

students.each do |s|
  m_distances = points.map{|p| cal_m_distances(s, p)}
  min_d_idx = m_distances.index(m_distances.min)
  puts min_d_idx
end