main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	var buildings = createNestedArray(4, 3, 10);
	lines.slice(1).forEach(function(line){
		var ary = line.split(" ").map(Number);
		buildings[ary[0]-1][ary[1]-1][ary[2]-1] += ary[3];
	});
	console.log(buildings.map(function(building){
		return building.map(function(floor){
			return " " + floor.join(" ");
		}).join("\n");
	}).join("\n####################\n"));
}

function createNestedArray(){
	return nest(Array.prototype.slice.call(arguments));
	function nest(numList){
		var nextList = numList.slice(1);
		if(numList.length == 0) return 0;
		else{
			var ary = [];
			for(var i=0;i<numList[0];i++){
				ary.push(nest(nextList));
			}
			return ary;
		}
	}
}