var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.split("\n");
Arr.shift();

/*
var bfr=[];
for(var i=0;i<4;i++){
	bfr.push([]);
	for(var j=0;j<3;j++){
		bfr[i].push([]);
		for(var k=0;k<10;k++)bfr[i][j].push(0);
	}
}
*/

 //引用 http://nmm.blog.jp/archives/36781312.html
    function arrayinit(){
    var args = arguments;
    var idx = 0;
    return ff()();
    function ff(){
    var a = args[idx++];
    var b = args.length==idx+1?aa(args[idx]):ff();
    return function(){
    return new Array(a).join(" ").split(" ").map(b);
    }
    }
    function aa(a){
    return function(){return a};
    }
    }

var bfr=arrayinit(4,3,10,0);

for(var i=0;i<Arr.length;i++){
	var arr=Arr[i].split(" ").map(Number);
	var b=arr[0]-1;
	var f=arr[1]-1;
	var r=arr[2]-1;
	var v=arr[3];
	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;
}
return;
var str="";
for(var i=0;i<4;i++){
	for(var j=0;j<3;j++){
		str+=bfr[i][j].join(" ")+"\n";
	}
if(i!=3)str+="####################\n";
}
console.log(str);