a = Array.new 4
a.map!{|b|
	b = Array.new 3
	b.map!{|c|
		c = Array.new 10,0
	}
}

gets.to_i.times{
	d = gets.split.map{|e|e.to_i}
	a[d[0]-1][d[1]-1][d[2]-1] += d[3]
}

a.each_with_index{|b,i|
	b.each{|c| 
		c.each{|d|
			print " "+d.to_s
		}
		puts ""
	} 
	puts "####################" if i != 3
} 