m = Array.new(4).map{Array.new(3).map{Array.new(10,0)}}
N = gets.to_i
N.times do |i|
    b,f,r,v = gets.split.map(&:to_i)
    m[b-1][f-1][r-1] += v
end
m.each_with_index do |x,i|
    x.each_with_index do |y,j|
        puts ' ' + y.join(' ')
    end
    puts "####################" unless i == 3
end
