/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int bill = 4;
		int floor = 3;
		int room = 10;

		int [][][] box = new int[bill][floor][room];

		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		//System.out.println(max);
		
		for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		}

		//result
		for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		}
		
		
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int bill = 4;
		int floor = 3;
		int room = 10;

		int [][][] box = new int[bill][floor][room];

		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		//System.out.println(max);
		
		for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		}

		//result
		for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		}
		
		
	}
} Main public static void main (String[] args) throws java.lang.Exception
	{
		int bill = 4;
		int floor = 3;
		int room = 10;

		int [][][] box = new int[bill][floor][room];

		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		//System.out.println(max);
		
		for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		}

		//result
		for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		}
		
		
	} main {
		int bill = 4;
		int floor = 3;
		int room = 10;

		int [][][] box = new int[bill][floor][room];

		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		//System.out.println(max);
		
		for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		}

		//result
		for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		}
		
		
	} int bill = 4; bill 4 int floor = 3; floor 3 int room = 10; room 10 int [][][] box = new int[bill][floor][room]; box new int[bill][floor][room] bill floor room Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int max = sc.nextInt(); max sc.nextInt() sc.nextInt sc for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		} int i = 0; int i = 0; i 0 i < max i max i++ i++ i {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		} {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		} int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int f = sc.nextInt(); f sc.nextInt() sc.nextInt sc int r = sc.nextInt(); r sc.nextInt() sc.nextInt sc int v = sc.nextInt(); v sc.nextInt() sc.nextInt sc box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v box[b-1][f-1][r-1] box[b-1][f-1] box[b-1] box b-1 b 1 f-1 f 1 r-1 r 1 box[b-1][f-1][r-1] + v box[b-1][f-1][r-1] box[b-1][f-1] box[b-1] box b-1 b 1 f-1 f 1 r-1 r 1 v for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		} int b = 0; int b = 0; b 0 b < bill b bill b++ b++ b {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		} {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		} for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			} int f = 0; int f = 0; f 0 f < floor f floor f++ f++ f {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			} {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			} for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				} int r = 0; int r = 0; r 0 r < room r room r++ r++ r {
					System.out.print(" " + box[b][f][r]);
				} {
					System.out.print(" " + box[b][f][r]);
				} System.out.print(" " + box[b][f][r]) System.out.print System.out System System.out " " + box[b][f][r] " " box[b][f][r] box[b][f] box[b] box b f r System.out.println("") System.out.println System.out System System.out "" if (b < bill-1) {
				System.out.println("####################");
			} b < bill-1 b bill-1 bill 1 {
				System.out.println("####################");
			} System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int bill = 4;
		int floor = 3;
		int room = 10;

		int [][][] box = new int[bill][floor][room];

		Scanner sc = new Scanner(System.in);
		int max = sc.nextInt();
		//System.out.println(max);
		
		for (int i = 0; i < max ;i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			//System.out.println(b + " " + f + " " + r + " "  + v);
			
			box[b-1][f-1][r-1] = box[b-1][f-1][r-1] + v;
		}

		//result
		for (int b = 0; b < bill; b++) {
			for (int f = 0; f < floor; f++) {
				for (int r = 0; r < room; r++) {
					System.out.print(" " + box[b][f][r]);
				}
				System.out.println("");
			}
			if (b < bill-1) {
				System.out.println("####################");
			}
		}
		
		
	}
}
