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

public class Main {
	
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
} Main public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int[][][] map = new int[4][3][10]; map new int[4][3][10] 4 3 10 for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[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++) {
					map[i][j][k] = 0;
				}
			}
		} {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		} for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[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++) {
					map[i][j][k] = 0;
				}
			} {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			} for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
					map[i][j][k] = 0;
				} {
					map[i][j][k] = 0;
				} map[i][j][k] = 0 map[i][j][k] map[i][j] map[i] map i j k 0 String x = ""; x "" try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} NumberFormatException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} IOException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} x = in.readLine() x in.readLine() in.readLine in int num = Integer.parseInt(x); num Integer.parseInt(x) Integer.parseInt Integer x for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			} int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			} {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			} x = in.readLine() x in.readLine() in.readLine in String[] data = x.split(" "); data x.split(" ") x.split x " " int b = (Integer.parseInt(data[0]) - 1); b (Integer.parseInt(data[0]) - 1) Integer.parseInt(data[0]) Integer.parseInt Integer data[0] data 0 1 int f = (Integer.parseInt(data[1]) - 1); f (Integer.parseInt(data[1]) - 1) Integer.parseInt(data[1]) Integer.parseInt Integer data[1] data 1 1 int r = (Integer.parseInt(data[2]) - 1); r (Integer.parseInt(data[2]) - 1) Integer.parseInt(data[2]) Integer.parseInt Integer data[2] data 2 1 int v = Integer.parseInt(data[3]); v Integer.parseInt(data[3]) Integer.parseInt Integer data[3] data 3 map[b][f][r] = map[b][f][r] + v map[b][f][r] map[b][f] map[b] map b f r map[b][f][r] + v map[b][f][r] map[b][f] map[b] map b f r v for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				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 k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		} {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		} for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			} {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			} for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
					System.out.print(" " + map[i][j][k]);
				} {
					System.out.print(" " + map[i][j][k]);
				} System.out.print(" " + map[i][j][k]) System.out.print System.out System System.out " " + map[i][j][k] " " map[i][j][k] map[i][j] map[i] map i j k 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[] args args public class Main {
	
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
} public class Main {
	
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		int[][][] map = new int[4][3][10];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					map[i][j][k] = 0;
				}
			}
		}
		
		String x = "";
		try {
			x = in.readLine();
			int num = Integer.parseInt(x);
			
			for (int i = 0; i < num; i++) {
				x = in.readLine();
				String[] data = x.split(" ");
				int b = (Integer.parseInt(data[0]) - 1);
				int f = (Integer.parseInt(data[1]) - 1);
				int r = (Integer.parseInt(data[2]) - 1);
				int v = Integer.parseInt(data[3]);
				
				map[b][f][r] = map[b][f][r] + v;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 3; j++) {
				for (int k = 0; k < 10; k++) {
					System.out.print(" " + map[i][j][k]);
				}
				System.out.println();
			}
			if (i != 3) {
				System.out.println("####################");
			}
		}
	}
}