house = []
4.times{house << Array.new(30, 0)}

n = gets.to_i

n.times do
    b, f, w, v = gets.split.map(&:to_i)
    house[b-1][10 * (f-1) + w-1] += v
end

i = 0
j = 0
house.each do |build|
    build.each do |floor|
        print " ", floor
        i += 1
        if i == 10
            puts
            i = 0
        end
    end
    puts "#"*20 if j < 3
    j += 1
end
