import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	private static final String DORM_SEPARATOR = "####################";
	private static int DORM_COUNT = 4;
	private static int FLOOR_COUNT = 3;
	private static int ROOM_COUNT = 10;

	public static void main(String[] args) {

		int n;
		int b, f, r, v;

		List<int[][]> house = new ArrayList<>();
		for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		}

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();

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

			house.get(b-1)[f-1][r-1] += v;

		}

		int count = 0;
		for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		}
	}

} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util class Main {

	private static final String DORM_SEPARATOR = "####################";
	private static int DORM_COUNT = 4;
	private static int FLOOR_COUNT = 3;
	private static int ROOM_COUNT = 10;

	public static void main(String[] args) {

		int n;
		int b, f, r, v;

		List<int[][]> house = new ArrayList<>();
		for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		}

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();

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

			house.get(b-1)[f-1][r-1] += v;

		}

		int count = 0;
		for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		}
	}

} Main private static final String DORM_SEPARATOR = "####################"; DORM_SEPARATOR "####################" private static int DORM_COUNT = 4; DORM_COUNT 4 private static int FLOOR_COUNT = 3; FLOOR_COUNT 3 private static int ROOM_COUNT = 10; ROOM_COUNT 10 public static void main(String[] args) {

		int n;
		int b, f, r, v;

		List<int[][]> house = new ArrayList<>();
		for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		}

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();

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

			house.get(b-1)[f-1][r-1] += v;

		}

		int count = 0;
		for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		}
	} main {

		int n;
		int b, f, r, v;

		List<int[][]> house = new ArrayList<>();
		for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		}

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();

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

			house.get(b-1)[f-1][r-1] += v;

		}

		int count = 0;
		for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		}
	} int n; n int b b f f r r v; v List<int[][]> house = new ArrayList<>(); house new ArrayList<>() for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		} int i = 1; int i = 1; i 1 i <= DORM_COUNT i DORM_COUNT i++ i++ i {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		} {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		} house.add(new int[FLOOR_COUNT][ROOM_COUNT]) house.add house new int[FLOOR_COUNT][ROOM_COUNT] FLOOR_COUNT ROOM_COUNT Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) n = stdIn.nextInt() n stdIn.nextInt() stdIn.nextInt stdIn for (int i = 0; i < n; i++) {
			b = stdIn.nextInt();
			f = stdIn.nextInt();
			r = stdIn.nextInt();
			v = stdIn.nextInt();

			house.get(b-1)[f-1][r-1] += v;

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

			house.get(b-1)[f-1][r-1] += v;

		} {
			b = stdIn.nextInt();
			f = stdIn.nextInt();
			r = stdIn.nextInt();
			v = stdIn.nextInt();

			house.get(b-1)[f-1][r-1] += v;

		} b = stdIn.nextInt() b stdIn.nextInt() stdIn.nextInt stdIn f = stdIn.nextInt() f stdIn.nextInt() stdIn.nextInt stdIn r = stdIn.nextInt() r stdIn.nextInt() stdIn.nextInt stdIn v = stdIn.nextInt() v stdIn.nextInt() stdIn.nextInt stdIn house.get(b-1)[f-1][r-1] += v house.get(b-1)[f-1][r-1] house.get(b-1)[f-1] house.get(b-1) house.get house b-1 b 1 f-1 f 1 r-1 r 1 v int count = 0; count 0 for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		} int[][] floor house {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		} {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		} for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			} int i = 0; int i = 0; i 0 i < FLOOR_COUNT i FLOOR_COUNT i++ i++ i {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			} {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			} for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				} int j = 0; int j = 0; j 0 j < ROOM_COUNT j ROOM_COUNT j++ j++ j {
					System.out.print(" " + floor[i][j]);
				} {
					System.out.print(" " + floor[i][j]);
				} System.out.print(" " + floor[i][j]) System.out.print System.out System System.out " " + floor[i][j] " " floor[i][j] floor[i] floor i j System.out.println() System.out.println System.out System System.out count++ count if(count == 4) {
				break;
			} count == 4 count 4 {
				break;
			} break; System.out.println(DORM_SEPARATOR) System.out.println System.out System System.out DORM_SEPARATOR String[] args args
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	private static final String DORM_SEPARATOR = "####################";
	private static int DORM_COUNT = 4;
	private static int FLOOR_COUNT = 3;
	private static int ROOM_COUNT = 10;

	public static void main(String[] args) {

		int n;
		int b, f, r, v;

		List<int[][]> house = new ArrayList<>();
		for (int i = 1; i <= DORM_COUNT; i++) {
			house.add(new int[FLOOR_COUNT][ROOM_COUNT]);
		}

		Scanner stdIn = new Scanner(System.in);

		n = stdIn.nextInt();

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

			house.get(b-1)[f-1][r-1] += v;

		}

		int count = 0;
		for(int[][] floor : house) {
			for(int i = 0; i < FLOOR_COUNT; i++) {
				for(int j = 0; j < ROOM_COUNT; j++) {
					System.out.print(" " + floor[i][j]);
				}
				System.out.println();
			}
			count++;
			if(count == 4) {
				break;
			}
			System.out.println(DORM_SEPARATOR);
		}
	}

}