"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

var re = /\s+|$/;
reader.on('close', () => {
    lines.shift();
    aux(lines);
});

function aux(lines)
{
    let sep="\n####################\n";
    var empty_room = [0,0,0,0,0,0,0,0,0,0];
    var residents = new Array(4);
    for (var b=0;b<4;b++) {
	residents[b] = new Array(3);
	for (var f=0;f<3;f++) {
	    residents[b][f] = Array.from(empty_room);
	}
    }
    
    let tenants = {};
    for (let notice of lines) {
	var b, f, r, v;
	[b, f, r, v] = notice.split(' ').map(Number);
	b -= 1;
	f -= 1;
	r -= 1;
	//console.log('b f r v: ', b,f,r,v);
	residents[b][f][r] += v;
    }
    //console.log('residents: ', residents);
    let buildings=[];
    for (b=0;b<4;b++){
	let building=[];
	for (f=0;f<3;f++){
	    let floor=[];
	    var fl = ' '+residents[b][f].map(String).join(' ');
	    //console.log('b,f: ', fl);
	    building.push(fl);
	}
	buildings.push(building);
    }
    var s=buildings.map(x=>x.join('\n')).join(sep);
    console.log(s);
    return;
}
