n = gets.chop.to_i
apt = Array.new(4){ Array.new(3){ Array.new(10, 0) } }

n.times do
  b, f, r, v = gets.chomp.split(/\s/).map(&:to_i)
  apt[b-1][f-1][r-1] += v
end

apt.each_with_index do |building, index|
  puts "#" * 20 if index > 0
  building.each { |floor| puts "\s" + floor.join("\s") }
end