import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				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[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	}

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

		Scanner sc = new Scanner(System.in);

		int[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	} main {

		Scanner sc = new Scanner(System.in);

		int[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[][][] house = new int[4][3][10]; house new int[4][3][10] 4 3 10 for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		} int i = 0; int i = 0; i 0 i < house.length i house.length house house.length i++ i++ i {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		} {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		} for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			} int j = 0; int j = 0; j 0 j < house[0].length j house[0].length house[0] house 0 house[0].length j++ j++ j {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			} {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			} for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				} int k = 0; int k = 0; k 0 k < house[0][0].length k house[0][0].length house[0][0] house[0] house 0 0 house[0][0].length k++ k++ k {
					house[i][j][k] = 0;
				} {
					house[i][j][k] = 0;
				} house[i][j][k] = 0 house[i][j][k] house[i][j] house[i] house i j k 0 String line1 = sc.nextLine(); line1 sc.nextLine() sc.nextLine sc int n = Integer.parseInt(line1); n Integer.parseInt(line1) Integer.parseInt Integer line1 for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		} {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		} String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc String[] array = line2.split(" "); array line2.split(" ") line2.split line2 " " int b = Integer.parseInt(array[0]) - 1; b Integer.parseInt(array[0]) - 1 Integer.parseInt(array[0]) Integer.parseInt Integer array[0] array 0 1 int f = Integer.parseInt(array[1]) - 1; f Integer.parseInt(array[1]) - 1 Integer.parseInt(array[1]) Integer.parseInt Integer array[1] array 1 1 int r = Integer.parseInt(array[2]) - 1; r Integer.parseInt(array[2]) - 1 Integer.parseInt(array[2]) Integer.parseInt Integer array[2] array 2 1 int v = Integer.parseInt(array[3]); v Integer.parseInt(array[3]) Integer.parseInt Integer array[3] array 3 house[b][f][r] += v house[b][f][r] house[b][f] house[b] house b f r v for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		} int i = 0; int i = 0; i 0 i < house.length i house.length house house.length i++ i++ i {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		} {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		} for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			} int j = 0; int j = 0; j 0 j < house[0].length j house[0].length house[0] house 0 house[0].length j++ j++ j {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			} {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			} for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				} int k = 0; int k = 0; k 0 k < house[0][0].length k house[0][0].length house[0][0] house[0] house 0 0 house[0][0].length k++ k++ k {
					System.out.print(" " + house[i][j][k]);
				} {
					System.out.print(" " + house[i][j][k]);
				} System.out.print(" " + house[i][j][k]) System.out.print System.out System System.out " " + house[i][j][k] " " house[i][j][k] house[i][j] house[i] house i j k System.out.println() System.out.println System.out System System.out if (i < house.length - 1) {
				System.out.println("####################");

			} i < house.length - 1 i house.length - 1 house.length house house.length 1 {
				System.out.println("####################");

			} 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[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[][][] house = new int[4][3][10];
		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					house[i][j][k] = 0;
				}

			}
		}

		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		for (int i = 0; i < n; i++) {
			String line2 = sc.nextLine();
			String[] array = line2.split(" ");
			int b = Integer.parseInt(array[0]) - 1;
			int f = Integer.parseInt(array[1]) - 1;
			int r = Integer.parseInt(array[2]) - 1;
			int v = Integer.parseInt(array[3]);

			house[b][f][r] += v;

		}

		for (int i = 0; i < house.length; i++) {
			for (int j = 0; j < house[0].length; j++) {
				for (int k = 0; k < house[0][0].length; k++) {
					System.out.print(" " + house[i][j][k]);
				}
				System.out.println();
			}
			if (i < house.length - 1) {
				System.out.println("####################");

			}
		}

	}

}