var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).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);
}
}
}

for(var i=0;i<Arr.length;i++){
var arr=Arr[i].split(" ");
var b=arr[0]-1;
var f=arr[1]-1;
var r=arr[2]-1;
var 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;

}

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);