def yoko!(y,l) puts "#{y} #{1} #{y + l} #{N}" $stdout.flush end def tate!(x, l) puts "#{1} #{x} #{N} #{x + l}" $stdout.flush end N, K = gets.split.map(&:to_i) L = gets.split.map(&:to_i) MAP = N.times.map{ gets.chomp.chars.map(&:to_i) } L.each_with_index do |l,i| if i.odd? yoko!(1, l) else tate!(1, l) end end