class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n,@m = gets.to_s.split.map{ |v| v.to_i }
    @a,@b = Array.new(n){ gets.to_s.split.map{ |v| v.to_i } }.transpose
    @c,@d = Array.new(n){ gets.to_s.split.map{ |v| v.to_i } }.transpose
  end

  def len(a,b,c,d)
    (a-c).abs + (b-d).abs
  end

  def solve
    ans = []
    n.times do |i|
      lens = n.times.map{|j|len(a[i],b[i],c[j],d[j])}
      mini = lens.min
      k = lens.find_index(mini)
      ans << k + 1
    end
    ans
  end

  def show(ans)
    ans.each do |a|
      puts a
    end
  end
end

Problem.new.instance_eval do
  show(solve)
end