import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	} InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} String input = br.readLine(); input br.readLine() br.readLine br int num = Integer.parseInt(input); num Integer.parseInt(input) Integer.parseInt Integer input int i i b b r r f f v; v int[][][] hoge = new int[4][3][10]; hoge new int[4][3][10] 4 3 10 for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			} i = 0; i = 0 i 0 i < num i num i++ i++ i {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			} {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			} String[] list = br.readLine().split(" "); list br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " b = Integer.parseInt(list[0]) - 1 b Integer.parseInt(list[0]) - 1 Integer.parseInt(list[0]) Integer.parseInt Integer list[0] list 0 1 r = Integer.parseInt(list[1]) - 1 r Integer.parseInt(list[1]) - 1 Integer.parseInt(list[1]) Integer.parseInt Integer list[1] list 1 1 f = Integer.parseInt(list[2]) - 1 f Integer.parseInt(list[2]) - 1 Integer.parseInt(list[2]) Integer.parseInt Integer list[2] list 2 1 v = Integer.parseInt(list[3]) v Integer.parseInt(list[3]) Integer.parseInt Integer list[3] list 3 int temp = hoge[b][r][f] + v; temp hoge[b][r][f] + v hoge[b][r][f] hoge[b][r] hoge[b] hoge b r f v if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				} temp > 9 temp 9 {
					temp = 9;
				} temp = 9 temp 9 if (temp < 0) {
					temp = 0;
				} temp < 0 temp 0 {
					temp = 0;
				} temp = 0 temp 0 hoge[b][r][f] = temp hoge[b][r][f] hoge[b][r] hoge[b] hoge b r f temp int x x y y z; z for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			} x = 0; x = 0 x 0 x < hoge.length x hoge.length hoge hoge.length x++ x++ x {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			} {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			} int[][] xlist = hoge[x]; xlist hoge[x] hoge x for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				} y = 0; y = 0 y 0 y < xlist.length y xlist.length xlist xlist.length y++ y++ y {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				} {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				} int[] ylist = xlist[y]; ylist xlist[y] xlist y for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					} z = 0; z = 0 z 0 z < ylist.length z ylist.length ylist ylist.length z++ z++ z {
						System.out.print(" " + ylist[z]);
					} {
						System.out.print(" " + ylist[z]);
					} System.out.print(" " + ylist[z]) System.out.print System.out System System.out " " + ylist[z] " " ylist[z] ylist z if (y != ylist.length - 1) {
						System.out.println();
					} y != ylist.length - 1 y ylist.length - 1 ylist.length ylist ylist.length 1 {
						System.out.println();
					} System.out.println() System.out.println System.out System System.out if (x != hoge.length - 1) {
					System.out.println("####################");
				} x != hoge.length - 1 x hoge.length - 1 hoge.length hoge hoge.length 1 {
					System.out.println("####################");
				} System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String input = br.readLine();
			int num = Integer.parseInt(input);
			int i, b, r, f, v;
			int[][][] hoge = new int[4][3][10];
			for (i = 0; i < num; i++) {
				String[] list = br.readLine().split(" ");
				b = Integer.parseInt(list[0]) - 1;
				r = Integer.parseInt(list[1]) - 1;
				f = Integer.parseInt(list[2]) - 1;
				v = Integer.parseInt(list[3]);

				int temp = hoge[b][r][f] + v;
				if (temp > 9) {
					temp = 9;
				} else if (temp < 0) {
					temp = 0;
				}
				hoge[b][r][f] = temp;
			}

			int x, y, z;
			for (x = 0; x < hoge.length; x++) {
				int[][] xlist = hoge[x];
				for (y = 0; y < xlist.length; y++) {
					int[] ylist = xlist[y];
					for (z = 0; z < ylist.length; z++) {
						System.out.print(" " + ylist[z]);
					}
					if (y != ylist.length - 1) {
						System.out.println();
					}
				}
				if (x != hoge.length - 1) {
					System.out.println("####################");
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}