import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

} import java.util.Scanner; Scanner java.util public class Main {

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count[][][] = new int[5][4][11]; count new int[5][4][11] 5 4 11 for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		} {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		} for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			} {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			} for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
					count[i][j][k] = 0;
				} {
					count[i][j][k] = 0;
				} count[i][j][k] = 0 count[i][j][k] count[i][j] count[i] count i j k 0 for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		} int i = 0; int 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();
			count[b][f][r] += v;
		} {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += 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 count[b][f][r] += v count[b][f][r] count[b][f] count[b] count b f r v for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		} int i = 1; int i = 1; i 1 i < 5 i 5 i++ i++ i {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		} {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		} if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			} i != 1 i 1 {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			} for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				} int x = 1; int x = 1; x 1 x < 21 x 21 x++ x++ x {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				} {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				} if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					} x != 20 x 20 {
						System.out.print("#");
					} System.out.print("#") System.out.print System.out System System.out "#" {
						System.out.println("#");
					} System.out.println("#") System.out.println System.out System System.out "#" for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			} int j = 1; int j = 1; j 1 j < 4 j 4 j++ j++ j {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			} {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			} for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				} int k = 1; int k = 1; k 1 k < 11 k 11 k++ k++ k {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				} {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				} if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					} k != 10 k 10 {
						System.out.print(" " + count[i][j][k]);
					} System.out.print(" " + count[i][j][k]) System.out.print System.out System System.out " " + count[i][j][k] " " count[i][j][k] count[i][j] count[i] count i j k {
						System.out.println(" " + count[i][j][k]);
					} System.out.println(" " + count[i][j][k]) System.out.println System.out System System.out " " + count[i][j][k] " " count[i][j][k] count[i][j] count[i] count i j k String[] args args public class Main {

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

} public class Main {

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

} Main
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int count[][][] = new int[5][4][11];

		// ?????????
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					count[i][j][k] = 0;
				}
			}
		}

		// ??????
		for (int i = 0; i < n; i++) {
			int b = sc.nextInt();
			int f = sc.nextInt();
			int r = sc.nextInt();
			int v = sc.nextInt();
			count[b][f][r] += v;
		}

		// ??????
		for (int i = 1; i < 5; i++) {
			if (i != 1) {
				for (int x = 1; x < 21; x++) {
					if (x != 20) {
						System.out.print("#");
					} else {
						System.out.println("#");
					}
				}
			}
			for (int j = 1; j < 4; j++) {
				for (int k = 1; k < 11; k++) {
					if (k != 10) {
						System.out.print(" " + count[i][j][k]);
					} else {
						System.out.println(" " + count[i][j][k]);
					}
				}
			}

		}

	}

}