import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	}
}

class Domi {
	private int bc = 4;
	private int fc = 3;
	private int rc = 10;
	private int[][][] psn = new int[bc][fc][rc];

	public void init() {
		for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0;

	}

	public void printAll() {
		for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		}
	}

	public void moving(String log) {
		String[] logs = log.split(" ");
		int b = Integer.valueOf(logs[0]);
		int f = Integer.valueOf(logs[1]);
		int r = Integer.valueOf(logs[2]);
		int v = Integer.valueOf(logs[3]);
		psn[b - 1][f - 1][r - 1] += v;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	} main {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	} BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); stdIn new BufferedReader(new InputStreamReader(System.in)) String s; s while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		} (s = stdIn.readLine()) != null (s = stdIn.readLine()) s stdIn.readLine() stdIn.readLine stdIn null {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		} int cnt = Integer.valueOf(s); cnt Integer.valueOf(s) Integer.valueOf Integer s Domi aUniv = new Domi(); aUniv new Domi() aUniv.init() aUniv.init aUniv for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			} int i = 0; int i = 0; i 0 i < cnt i cnt i++ i++ i {
				aUniv.moving(stdIn.readLine());
			} {
				aUniv.moving(stdIn.readLine());
			} aUniv.moving(stdIn.readLine()) aUniv.moving aUniv stdIn.readLine() stdIn.readLine stdIn aUniv.printAll() aUniv.printAll aUniv System.exit(0) System.exit System 0 String[] args args class Domi {
	private int bc = 4;
	private int fc = 3;
	private int rc = 10;
	private int[][][] psn = new int[bc][fc][rc];

	public void init() {
		for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0;

	}

	public void printAll() {
		for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		}
	}

	public void moving(String log) {
		String[] logs = log.split(" ");
		int b = Integer.valueOf(logs[0]);
		int f = Integer.valueOf(logs[1]);
		int r = Integer.valueOf(logs[2]);
		int v = Integer.valueOf(logs[3]);
		psn[b - 1][f - 1][r - 1] += v;
	}

} Domi private int bc = 4; bc 4 private int fc = 3; fc 3 private int rc = 10; rc 10 private int[][][] psn = new int[bc][fc][rc]; psn new int[bc][fc][rc] bc fc rc public void init() {
		for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0;

	} init {
		for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0;

	} for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0; int b = 0; int b = 0; b 0 b < bc b bc b++ b++ b for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0; for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0; int f = 0; int f = 0; f 0 f < fc f fc f++ f++ f for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0; for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0; int r = 0; int r = 0; r 0 r < rc r rc r++ r++ r psn[b][f][r] = 0; psn[b][f][r] = 0 psn[b][f][r] psn[b][f] psn[b] psn b f r 0 public void printAll() {
		for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		}
	} printAll {
		for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		}
	} for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		} int b = 0; int b = 0; b 0 b < bc b bc b++ b++ b {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		} {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		} if (b > 0)
				System.out.println("####################"); b > 0 b 0 System.out.println("####################") System.out.println System.out System System.out "####################" for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			} int f = 0; int f = 0; f 0 f < fc f fc f++ f++ f {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			} {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			} for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]); int r = 0; int r = 0; r 0 r < rc r rc r++ r++ r System.out.print(" " + psn[b][f][r]); System.out.print(" " + psn[b][f][r]) System.out.print System.out System System.out " " + psn[b][f][r] " " psn[b][f][r] psn[b][f] psn[b] psn b f r System.out.println("") System.out.println System.out System System.out "" public void moving(String log) {
		String[] logs = log.split(" ");
		int b = Integer.valueOf(logs[0]);
		int f = Integer.valueOf(logs[1]);
		int r = Integer.valueOf(logs[2]);
		int v = Integer.valueOf(logs[3]);
		psn[b - 1][f - 1][r - 1] += v;
	} moving {
		String[] logs = log.split(" ");
		int b = Integer.valueOf(logs[0]);
		int f = Integer.valueOf(logs[1]);
		int r = Integer.valueOf(logs[2]);
		int v = Integer.valueOf(logs[3]);
		psn[b - 1][f - 1][r - 1] += v;
	} String[] logs = log.split(" "); logs log.split(" ") log.split log " " int b = Integer.valueOf(logs[0]); b Integer.valueOf(logs[0]) Integer.valueOf Integer logs[0] logs 0 int f = Integer.valueOf(logs[1]); f Integer.valueOf(logs[1]) Integer.valueOf Integer logs[1] logs 1 int r = Integer.valueOf(logs[2]); r Integer.valueOf(logs[2]) Integer.valueOf Integer logs[2] logs 2 int v = Integer.valueOf(logs[3]); v Integer.valueOf(logs[3]) Integer.valueOf Integer logs[3] logs 3 psn[b - 1][f - 1][r - 1] += v psn[b - 1][f - 1][r - 1] psn[b - 1][f - 1] psn[b - 1] psn b - 1 b 1 f - 1 f 1 r - 1 r 1 v String log log public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
		String s;
		while ((s = stdIn.readLine()) != null) {
			int cnt = Integer.valueOf(s);
			Domi aUniv = new Domi();
			aUniv.init();
			for (int i = 0; i < cnt; i++) {
				aUniv.moving(stdIn.readLine());
			}
			aUniv.printAll();
		}
		System.exit(0);
	}
}

class Domi {
	private int bc = 4;
	private int fc = 3;
	private int rc = 10;
	private int[][][] psn = new int[bc][fc][rc];

	public void init() {
		for (int b = 0; b < bc; b++)
			for (int f = 0; f < fc; f++)
				for (int r = 0; r < rc; r++)
					psn[b][f][r] = 0;

	}

	public void printAll() {
		for (int b = 0; b < bc; b++) {
			if (b > 0)
				System.out.println("####################");
			for (int f = 0; f < fc; f++) {
				for (int r = 0; r < rc; r++)
					System.out.print(" " + psn[b][f][r]);
				System.out.println("");
			}
		}
	}

	public void moving(String log) {
		String[] logs = log.split(" ");
		int b = Integer.valueOf(logs[0]);
		int f = Integer.valueOf(logs[1]);
		int r = Integer.valueOf(logs[2]);
		int v = Integer.valueOf(logs[3]);
		psn[b - 1][f - 1][r - 1] += v;
	}

}