N,M = gets.split.map(&:to_i)
Vector = Struct.new(x,y,move_x,move_y)
n = []
m = []
N.times do
	x,y = gets.split.map(&:to_i)
	n << Vector.new(x: x,y: y)
end

M.times do
	x,y = gets.split.map(&:to_i)
	m << Vector.new(x: x,y: y)
end

score = Array.new(N){Float::INFINITY}
N.times do |i|
	M.times do |j|
		tmp = (n[i].x - m[j].x).abs + (n[i].y - m[j].y).abs
		 if tmp < score[i]
		 	score[i] = tmp
		 	n[i].move_x = m[j].x
		 	n[i].move_y = m[j].y
		 end
	end
end

n.each do |nn|
	puts nn.move_x.to_s + " " + nn.move_y.to_s 
end





