def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

property = Array.new(4).map{Array.new(3).map{Array.new(10, 0)}}
n = STDIN.gets
n = n.to_i

1.upto(n) {|i|
	b, f, r, v = array_integer(STDIN.gets.split(" "))
	b -= 1
	f -= 1
	r -= 1
	property[b][f][r] += v
}

0.upto(3) {|b|
	0.upto(2) {|f|
		0.upto(9) {|r|
			print " ", property[b][f][r]
		}
		print "\n"
	}
	print "####################\n" if b != 3
}
