import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	}

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

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	} main {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int dartenc = Integer.parseInt(line); dartenc Integer.parseInt(line) Integer.parseInt Integer line String[] k = new String[dartenc]; k new String[dartenc] dartenc int[][][] darten = new int[4][3][10]; darten new int[4][3][10] 4 3 10 for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		} int i = 0; int i = 0; i 0 i < darten.length i darten.length darten darten.length i++ i++ i {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		} {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		} for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			} int j = 0; int j = 0; j 0 j < darten[1].length j darten[1].length darten[1] darten 1 darten[1].length j++ j++ j {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			} {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			} for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				} int j2 = 0; int j2 = 0; j2 0 j2 < darten[0].length j2 darten[0].length darten[0] darten 0 darten[0].length j2++ j2++ j2 {
					darten[i][j][j2] = 0;
				} {
					darten[i][j][j2] = 0;
				} darten[i][j][j2] = 0 darten[i][j][j2] darten[i][j] darten[i] darten i j j2 0 for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		} int i = 0; int i = 0; i 0 i < k.length i k.length k k.length i++ i++ i {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		} {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		} k[i] = sc.nextLine() k[i] k i sc.nextLine() sc.nextLine sc String[] v = k[i].split(" "); v k[i].split(" ") k[i].split k[i] k i " " int[] a = new int[4]; a new int[4] 4 for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			} int j = 0; int j = 0; j 0 j < a.length j a.length a a.length j++ j++ j {
				a[j] = Integer.parseInt(v[j]);
			} {
				a[j] = Integer.parseInt(v[j]);
			} a[j] = Integer.parseInt(v[j]) a[j] a j Integer.parseInt(v[j]) Integer.parseInt Integer v[j] v j darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3] darten[a[0] - 1][a[1] - 1][a[2] - 1] darten[a[0] - 1][a[1] - 1] darten[a[0] - 1] darten a[0] - 1 a[0] a 0 1 a[1] - 1 a[1] a 1 1 a[2] - 1 a[2] a 2 1 a[3] a 3 for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		} {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		} for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			} {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			} for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				} int j2 = 0; int j2 = 0; j2 0 j2 < 10 j2 10 j2++ j2++ j2 {
					System.out.print(" "+darten[i][j][j2]);
				} {
					System.out.print(" "+darten[i][j][j2]);
				} System.out.print(" "+darten[i][j][j2]) System.out.print System.out System System.out " "+darten[i][j][j2] " " darten[i][j][j2] darten[i][j] darten[i] darten i j j2 System.out.println("") System.out.println System.out System System.out "" if (i!=3) {
				System.out.println("####################");
			
			} i!=3 i 3 {
				System.out.println("####################");
			
			} System.out.println("####################") System.out.println System.out System System.out "####################" String[] arges arges public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	}

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

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int dartenc = Integer.parseInt(line);
		String[] k = new String[dartenc];
		int[][][] darten = new int[4][3][10];

		for (int i = 0; i < darten.length; i++) {
			for (int j = 0; j < darten[1].length; j++) {
				for (int j2 = 0; j2 < darten[0].length; j2++) {
					darten[i][j][j2] = 0;
				}
			}
		}
		for (int i = 0; i < k.length; i++) {
			k[i] = sc.nextLine();
			String[] v = k[i].split(" ");
			int[] a = new int[4];
			for (int j = 0; j < a.length; j++) {
				a[j] = Integer.parseInt(v[j]);
			}
			darten[a[0] - 1][a[1] - 1][a[2] - 1] += a[3];// ?????¢...b?£?f??????r?????????????????§??\???

		}

		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int j2 = 0; j2 < 10; j2++) {
					System.out.print(" "+darten[i][j][j2]);
				}
				System.out.println("");
				
			}if (i!=3) {
				System.out.println("####################");
			
			}
			
		}

	}

}