rooms = Array.new(4).map{Array.new(3).map{Array.new(10,0)}}

gets.to_i.times do
    b, f, r, v = gets.split(' ').map(&:to_i)
    rooms[b-1][f-1][r-1] += v
end

4.times do |house|
    3.times do |floor|
        puts ' ' + rooms[house][floor].join(' ')
    end
    puts '#'*20 if house < 3
end
