hash = {}
sep = "#"*20
(1..4).each do |b|
    (1..3).each do |f|
        (1..10).each do |r|
            hash["#{b}#{f}#{r}"]=0
        end
    end
end

gets.chomp.to_i.times do
    b,f,r,v = gets.chomp.split.map(&:to_i)
    hash["#{b}#{f}#{r}"] += v
end

(1..4).each do |b|
    (1..3).each do |f|
        (1..10).each do |r|
            print " " + hash["#{b}#{f}#{r}"].to_s
        end
        puts
    end
    puts sep unless b.zero?
end