n = gets.to_i
ans = Array.new(4){Array.new(3) {Array.new(10, 0)}}
n.times do |i|
  b, f, r, v = gets.chomp.split.map(&:to_i)
  ans[b-1][f-1][r-1] += v
  ans[b-1][f-1][r-1] = [ans[b-1][f-1][r-1], 0].max
end

ans.each do |ff|
  ff.each do |rr|
    puts " " + rr.join(" ")
  end
  puts "####################" unless ff.equal?(ans.last)
end

