import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	} main {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i; i int j; j int array1[][] = new int[3][10]; array1 new int[3][10] 3 10 int array2[][] = new int[3][10]; array2 new int[3][10] 3 10 int array3[][] = new int[3][10]; array3 new int[3][10] 3 10 int array4[][] = new int[3][10]; array4 new int[3][10] 3 10 for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			} i = 0; i = 0 i 0 i < 3 i 3 i++ i++ i {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			} {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			} for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				} j = 0; j = 0 j 0 j < 10 j 10 j++ j++ j {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				} {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				} array1[i][j] = 0 array1[i][j] array1[i] array1 i j 0 array2[i][j] = 0 array2[i][j] array2[i] array2 i j 0 array3[i][j] = 0 array3[i][j] array3[i] array3 i j 0 array4[i][j] = 0 array4[i][j] array4[i] array4 i j 0 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			} i = 0; i = 0 i 0 i < n i n i++ i++ i {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			} {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			} 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 if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				} b == 1 b 1 {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				} array1[f - 1][r - 1] += v array1[f - 1][r - 1] array1[f - 1] array1 f - 1 f 1 r - 1 r 1 v if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					} array1[f - 1][r - 1] < 0 array1[f - 1][r - 1] array1[f - 1] array1 f - 1 f 1 r - 1 r 1 0 {
						array1[f - 1][r - 1] = 0;
					} array1[f - 1][r - 1] = 0 array1[f - 1][r - 1] array1[f - 1] array1 f - 1 f 1 r - 1 r 1 0 if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					} array1[f - 1][r - 1] > 9 array1[f - 1][r - 1] array1[f - 1] array1 f - 1 f 1 r - 1 r 1 9 {
						array1[f - 1][r - 1] = 9;
					} array1[f - 1][r - 1] = 9 array1[f - 1][r - 1] array1[f - 1] array1 f - 1 f 1 r - 1 r 1 9 if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				} b == 2 b 2 {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				} array2[f - 1][r - 1] += v array2[f - 1][r - 1] array2[f - 1] array2 f - 1 f 1 r - 1 r 1 v if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					} array2[f - 1][r - 1] < 0 array2[f - 1][r - 1] array2[f - 1] array2 f - 1 f 1 r - 1 r 1 0 {
						array2[f - 1][r - 1] = 0;
					} array2[f - 1][r - 1] = 0 array2[f - 1][r - 1] array2[f - 1] array2 f - 1 f 1 r - 1 r 1 0 if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					} array2[f - 1][r - 1] > 9 array2[f - 1][r - 1] array2[f - 1] array2 f - 1 f 1 r - 1 r 1 9 {
						array2[f - 1][r - 1] = 9;
					} array2[f - 1][r - 1] = 9 array2[f - 1][r - 1] array2[f - 1] array2 f - 1 f 1 r - 1 r 1 9 if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				} b == 3 b 3 {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				} array3[f - 1][r - 1] += v array3[f - 1][r - 1] array3[f - 1] array3 f - 1 f 1 r - 1 r 1 v if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					} array3[f - 1][r - 1] < 0 array3[f - 1][r - 1] array3[f - 1] array3 f - 1 f 1 r - 1 r 1 0 {
						array3[f - 1][r - 1] = 0;
					} array3[f - 1][r - 1] = 0 array3[f - 1][r - 1] array3[f - 1] array3 f - 1 f 1 r - 1 r 1 0 if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					} array3[f - 1][r - 1] > 9 array3[f - 1][r - 1] array3[f - 1] array3 f - 1 f 1 r - 1 r 1 9 {
						array3[f - 1][r - 1] = 9;
					} array3[f - 1][r - 1] = 9 array3[f - 1][r - 1] array3[f - 1] array3 f - 1 f 1 r - 1 r 1 9 if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				} b == 4 b 4 {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				} array4[f - 1][r - 1] += v array4[f - 1][r - 1] array4[f - 1] array4 f - 1 f 1 r - 1 r 1 v if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					} array4[f - 1][r - 1] < 0 array4[f - 1][r - 1] array4[f - 1] array4 f - 1 f 1 r - 1 r 1 0 {
						array4[f - 1][r - 1] = 0;
					} array4[f - 1][r - 1] = 0 array4[f - 1][r - 1] array4[f - 1] array4 f - 1 f 1 r - 1 r 1 0 if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					} array4[f - 1][r - 1] > 9 array4[f - 1][r - 1] array4[f - 1] array4 f - 1 f 1 r - 1 r 1 9 {
						array4[f - 1][r - 1] = 9;
					} array4[f - 1][r - 1] = 9 array4[f - 1][r - 1] array4[f - 1] array4 f - 1 f 1 r - 1 r 1 9 for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			} i = 0; i = 0 i 0 i < 3 i 3 i++ i++ i {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			} {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			} for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				} j = 0; j = 0 j 0 j < 10 j 10 j++ j++ j {
					System.out.print(" " + array1[i][j]);
				} {
					System.out.print(" " + array1[i][j]);
				} System.out.print(" " + array1[i][j]) System.out.print System.out System System.out " " + array1[i][j] " " array1[i][j] array1[i] array1 i j System.out.println() System.out.println System.out System System.out System.out.println("####################") System.out.println System.out System System.out "####################" for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			} i = 0; i = 0 i 0 i < 3 i 3 i++ i++ i {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			} {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			} for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				} j = 0; j = 0 j 0 j < 10 j 10 j++ j++ j {
					System.out.print(" " + array2[i][j]);
				} {
					System.out.print(" " + array2[i][j]);
				} System.out.print(" " + array2[i][j]) System.out.print System.out System System.out " " + array2[i][j] " " array2[i][j] array2[i] array2 i j System.out.println() System.out.println System.out System System.out System.out.println("####################") System.out.println System.out System System.out "####################" for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			} i = 0; i = 0 i 0 i < 3 i 3 i++ i++ i {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			} {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			} for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				} j = 0; j = 0 j 0 j < 10 j 10 j++ j++ j {
					System.out.print(" " + array3[i][j]);
				} {
					System.out.print(" " + array3[i][j]);
				} System.out.print(" " + array3[i][j]) System.out.print System.out System System.out " " + array3[i][j] " " array3[i][j] array3[i] array3 i j System.out.println() System.out.println System.out System System.out System.out.println("####################") System.out.println System.out System System.out "####################" for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			} i = 0; i = 0 i 0 i < 3 i 3 i++ i++ i {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			} {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			} for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				} j = 0; j = 0 j 0 j < 10 j 10 j++ j++ j {
					System.out.print(" " + array4[i][j]);
				} {
					System.out.print(" " + array4[i][j]);
				} System.out.print(" " + array4[i][j]) System.out.print System.out System System.out " " + array4[i][j] " " array4[i][j] array4[i] array4 i j System.out.println() System.out.println System.out System System.out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	}
} Main
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

			int i;
			int j;

			int array1[][] = new int[3][10];
			int array2[][] = new int[3][10];
			int array3[][] = new int[3][10];
			int array4[][] = new int[3][10];

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					array1[i][j] = 0;
					array2[i][j] = 0;
					array3[i][j] = 0;
					array4[i][j] = 0;
				}
			}

			int n = sc.nextInt();
			for(i = 0; i < n; i++) {

				int b = sc.nextInt();
				int f = sc.nextInt();
				int r = sc.nextInt();
				int v = sc.nextInt();

				if(b == 1) {
					array1[f - 1][r - 1] += v;

					if(array1[f - 1][r - 1] < 0) {
						array1[f - 1][r - 1] = 0;
					}

					if(array1[f - 1][r - 1] > 9) {
						array1[f - 1][r - 1] = 9;
					}
				}

				if(b == 2) {
					array2[f - 1][r - 1] += v;

					if(array2[f - 1][r - 1] < 0) {
						array2[f - 1][r - 1] = 0;
					}

					if(array2[f - 1][r - 1] > 9) {
						array2[f - 1][r - 1] = 9;
					}
				}

				if(b == 3) {
					array3[f - 1][r - 1] += v;

					if(array3[f - 1][r - 1] < 0) {
						array3[f - 1][r - 1] = 0;
					}

					if(array3[f - 1][r - 1] > 9) {
						array3[f - 1][r - 1] = 9;
					}
				}

				if(b == 4) {
					array4[f - 1][r - 1] += v;

					if(array4[f - 1][r - 1] < 0) {
						array4[f - 1][r - 1] = 0;
					}

					if(array4[f - 1][r - 1] > 9) {
						array4[f - 1][r - 1] = 9;
					}
				}

			}

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array1[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array2[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array3[i][j]);
				}
				System.out.println();
			}
			System.out.println("####################");

			for(i = 0; i < 3; i++) {
				for(j = 0; j < 10; j++) {
					System.out.print(" " + array4[i][j]);
				}
				System.out.println();
			}

	}
}