function Main(input) {
	let Arr = (input.trim()).split("\n");
	Arr.shift();
	 
	let bfr = [];
	for (let i = 0; i < 4; i++) {
		bfr.push([]);
		for (let j = 0; j < 3; j++) {
			bfr[i].push([]);
			for (let k = 0; k < 10; k++) {
				bfr[i][j].push(0);
			}
		}
	}
	 
	for (let i = 0; i < Arr.length; i++) {
		let arr = Arr[i].split(" ").map(Number);
		let b = arr[0] - 1;
		let f = arr[1] - 1;
		let r = arr[2] - 1;
		let v = arr[3] - 0;
	 
		bfr[b][f][r] = bfr[b][f][r] + v;
		if (bfr[b][f][r] > 9) bfr[b][f][r] = 9;
		if (bfr[b][f][r] < 0) bfr[b][f][r] = 0;
	 
	}
	 
	for (let i = 0; i < 4; i++) {
		for (let j = 0; j < 3; j++) {
			console.log(" " + bfr[i][j].join(" "));
		}
		if (i !== 3) console.log("####################");
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
