def out (a) 
    3.times do |b|
        10.times do |f|
            print " ", a[b][f]
        end
        print "\n"
    end
end

a0 = Array.new(3).map{Array.new(10,0)}
a1 = Array.new(3).map{Array.new(10,0)}
a2 = Array.new(3).map{Array.new(10,0)}
a3 = Array.new(3).map{Array.new(10,0)}
n = gets.to_i
n.times do
    i = gets
    b = i.split[0].to_i - 1
    f = i.split[1].to_i - 1
    r = i.split[2].to_i - 1
    v = i.split[3].to_i
    a0[f][r] += v if b == 0
    a1[f][r] += v if b == 1
    a2[f][r] += v if b == 2
    a3[f][r] += v if b == 3
end
out(a0)
print "####################\n"
out(a1)
print "####################\n"
out(a2)
print "####################\n"
out(a3)
