#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C

n = gets.to_i

hash = {}

for b in 1..4
for f in 1..3
for r in 1..10
    key = b.to_s + "," + f.to_s + "," + r.to_s
    hash[key]=0
end
end
end

n.times do
    b,f,r,v = gets.split.map(&:to_i)
    key = b.to_s + "," + f.to_s + "," + r.to_s
    hash[key]+=v
end

for b in 1..4
for f in 1..3
for r in 1..10
    key = b.to_s + "," + f.to_s + "," + r.to_s
    v = hash[key]
    print " " + v.to_s
end
puts
end
puts "#"*20
end