n, k=gets.split.map(&:to_i) li=gets.split.map(&:to_i) n.times{gets} li.each do |l| x, y=rand(1..(n-l+1)), rand(1..(n-l+1)) if rand(0..1)%2==0 puts "#{x} #{y} #{x} #{y+l-1}" else puts "#{x} #{y} #{x+l-1} #{y}" end end