import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		int[][] A = new int[3][10];
		int[][] B = new int[3][10];
		int[][] C = new int[3][10];
		int[][] D = new int[3][10];

		for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		}

		int n = scane.nextInt();
		int b, f, r, v;

		for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		}
		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		}



	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main {

	public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		int[][] A = new int[3][10];
		int[][] B = new int[3][10];
		int[][] C = new int[3][10];
		int[][] D = new int[3][10];

		for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		}

		int n = scane.nextInt();
		int b, f, r, v;

		for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		}
		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		}



	}
} Main public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		int[][] A = new int[3][10];
		int[][] B = new int[3][10];
		int[][] C = new int[3][10];
		int[][] D = new int[3][10];

		for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		}

		int n = scane.nextInt();
		int b, f, r, v;

		for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		}
		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		}



	} main {

		Scanner scane = new Scanner(System.in);

		int[][] A = new int[3][10];
		int[][] B = new int[3][10];
		int[][] C = new int[3][10];
		int[][] D = new int[3][10];

		for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		}

		int n = scane.nextInt();
		int b, f, r, v;

		for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		}
		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		}



	} Scanner scane = new Scanner(System.in); scane new Scanner(System.in) int[][] A = new int[3][10]; A new int[3][10] 3 10 int[][] B = new int[3][10]; B new int[3][10] 3 10 int[][] C = new int[3][10]; C new int[3][10] 3 10 int[][] D = new int[3][10]; D new int[3][10] 3 10 for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		} int i =0; int i =0; i 0 i<3 i 3 i++ i++ i {
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		} {
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		} for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			} int j = 0; int j = 0; j 0 j<10 j 10 j++ j++ j {
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			} {
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			} A[i][j] =0 A[i][j] A[i] A i j 0 B[i][j] =0 B[i][j] B[i] B i j 0 C[i][j] =0 C[i][j] C[i] C i j 0 D[i][j] =0 D[i][j] D[i] D i j 0 int n = scane.nextInt(); n scane.nextInt() scane.nextInt scane int b b f f r r v; v for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		} {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		} b = scane.nextInt() b scane.nextInt() scane.nextInt scane f = scane.nextInt() f scane.nextInt() scane.nextInt scane r = scane.nextInt() r scane.nextInt() scane.nextInt scane v = scane.nextInt() v scane.nextInt() scane.nextInt scane if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			} b == 1 b 1 {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} A[f - 1][r - 1] = A[f - 1][r - 1]+v A[f - 1][r - 1] A[f - 1] A f - 1 f 1 r - 1 r 1 A[f - 1][r - 1]+v A[f - 1][r - 1] A[f - 1] A f - 1 f 1 r - 1 r 1 v if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			} b == 2 b 2 {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} B[f - 1][r - 1] = B[f - 1][r - 1]+v B[f - 1][r - 1] B[f - 1] B f - 1 f 1 r - 1 r 1 B[f - 1][r - 1]+v B[f - 1][r - 1] B[f - 1] B f - 1 f 1 r - 1 r 1 v if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			} b == 3 b 3 {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} C[f - 1][r - 1] = C[f - 1][r - 1]+v C[f - 1][r - 1] C[f - 1] C f - 1 f 1 r - 1 r 1 C[f - 1][r - 1]+v C[f - 1][r - 1] C[f - 1] C f - 1 f 1 r - 1 r 1 v if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			} b == 4 b 4 {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			} D[f - 1][r - 1] = D[f - 1][r - 1]+v D[f - 1][r - 1] D[f - 1] D f - 1 f 1 r - 1 r 1 D[f - 1][r - 1]+v D[f - 1][r - 1] D[f - 1] D f - 1 f 1 r - 1 r 1 v for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		} {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		} for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			} int j = 0; int j = 0; j 0 j < A[0].length j A[0].length A[0] A 0 A[0].length j++ j++ j {
				System.out.print(" " + A[i][j]);
			} {
				System.out.print(" " + A[i][j]);
			} System.out.print(" " + A[i][j]) System.out.print System.out System System.out " " + A[i][j] " " A[i][j] A[i] A i j System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < 20; i++) {
			System.out.print("#");
		} int i = 0; int i = 0; i 0 i < 20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		} int i = 0; int i = 0; i 0 i < B.length i B.length B B.length i++ i++ i {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		} {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		} for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			} int j = 0; int j = 0; j 0 j < B[0].length j B[0].length B[0] B 0 B[0].length j++ j++ j {
				System.out.print(" " + B[i][j]);
			} {
				System.out.print(" " + B[i][j]);
			} System.out.print(" " + B[i][j]) System.out.print System.out System System.out " " + B[i][j] " " B[i][j] B[i] B i j System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < 20; i++) {
			System.out.print("#");
		} int i = 0; int i = 0; i 0 i < 20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		} int i = 0; int i = 0; i 0 i < C.length i C.length C C.length i++ i++ i {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		} {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		} for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			} int j = 0; int j = 0; j 0 j < C[0].length j C[0].length C[0] C 0 C[0].length j++ j++ j {
				System.out.print(" " + C[i][j]);
			} {
				System.out.print(" " + C[i][j]);
			} System.out.print(" " + C[i][j]) System.out.print System.out System System.out " " + C[i][j] " " C[i][j] C[i] C i j System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < 20; i++) {
			System.out.print("#");
		} int i = 0; int i = 0; i 0 i < 20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		} int i = 0; int i = 0; i 0 i < D.length i D.length D D.length i++ i++ i {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		} {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		} for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			} int j = 0; int j = 0; j 0 j < D[0].length j D[0].length D[0] D 0 D[0].length j++ j++ j {
				System.out.print(" " + D[i][j]);
			} {
				System.out.print(" " + D[i][j]);
			} System.out.print(" " + D[i][j]) System.out.print System.out System System.out " " + D[i][j] " " D[i][j] D[i] D i j System.out.println("") System.out.println System.out System System.out "" String[] args args
import java.io.IOException;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {

		Scanner scane = new Scanner(System.in);

		int[][] A = new int[3][10];
		int[][] B = new int[3][10];
		int[][] C = new int[3][10];
		int[][] D = new int[3][10];

		for(int i =0; i<3;i++){
			for(int j = 0; j<10; j++){
				A[i][j] =0;
				B[i][j] =0;
				C[i][j] =0;
				D[i][j] =0;
			}

		}

		int n = scane.nextInt();
		int b, f, r, v;

		for (int i = 0; i < n; i++) {
			b = scane.nextInt();
			f = scane.nextInt();
			r = scane.nextInt();
			v = scane.nextInt();

			if (b == 1) {
				A[f - 1][r - 1] = A[f - 1][r - 1]+v;
			} else if (b == 2) {
				B[f - 1][r - 1] = B[f - 1][r - 1]+v;
			} else if (b == 3) {
				C[f - 1][r - 1] = C[f - 1][r - 1]+v;
			} else if (b == 4) {
				D[f - 1][r - 1] = D[f - 1][r - 1]+v;
			}
		}
		for (int i = 0; i < A.length; i++) {
			for (int j = 0; j < A[0].length; j++) {
				System.out.print(" " + A[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[0].length; j++) {
				System.out.print(" " + B[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");

		for (int i = 0; i < C.length; i++) {
			for (int j = 0; j < C[0].length; j++) {
				System.out.print(" " + C[i][j]);
			}
			System.out.println("");
		}
		for (int i = 0; i < 20; i++) {
			System.out.print("#");
		}
		System.out.println("");


		for (int i = 0; i < D.length; i++) {
			for (int j = 0; j < D[0].length; j++) {
				System.out.print(" " + D[i][j]);
			}
			System.out.println("");
		}



	}
}