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

4.times do |i|
  3.times do |j|
    puts " " + x[i][j].join(" ")
  end
  puts "#"*20 if i < 3
end