data = gets.to_i
ary = []

4.times do
    ary << Array.new(3){Array.new(10, 0)}
end
data.times do
    b, f, r, v = gets.split(" ").map(&:to_i)
    ary[b - 1][f - 1][r - 1] += v
end
4.times do |i|
    3.times do |j|
        print " "
        puts ary[i][j].join(" ")
        puts "#" * 20 if (j == 2) && (i < 3)
    end
end