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

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) 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) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		}
	}

} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int[][][] house = new int[3][10][4]; house new int[3][10][4] 3 10 4 String count = br.readLine(); count br.readLine() br.readLine br for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		} int i = 0 ; int i = 0 ; i 0 i < Integer.parseInt(count) i Integer.parseInt(count) Integer.parseInt Integer count i++ i++ i {
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		} {
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		} String info = br.readLine(); info br.readLine() br.readLine br String[] ia = info.split(" "); ia info.split(" ") info.split info " " house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]) house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1] house[Integer.parseInt(ia[1])-1] house Integer.parseInt(ia[1])-1 Integer.parseInt(ia[1]) Integer.parseInt Integer ia[1] ia 1 1 Integer.parseInt(ia[2])-1 Integer.parseInt(ia[2]) Integer.parseInt Integer ia[2] ia 2 1 Integer.parseInt(ia[0])-1 Integer.parseInt(ia[0]) Integer.parseInt Integer ia[0] ia 0 1 Integer.parseInt(ia[3]) Integer.parseInt Integer ia[3] ia 3 for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		} int i = 0 ; int i = 0 ; i 0 i < house[2][0].length i house[2][0].length house[2][0] house[2] house 2 0 house[2][0].length i++ i++ i {
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		} {
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		} for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			} int j = 0 ; int j = 0 ; j 0 j < house.length j house.length house house.length j++ j++ j {
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			} {
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			} for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				} int k = 0 ; int k = 0 ; k 0 k < house[j].length k house[j].length house[j] house j house[j].length k++ k++ k {
					System.out.print(" " + house[j][k][i]);
				} {
					System.out.print(" " + house[j][k][i]);
				} System.out.print(" " + house[j][k][i]) System.out.print System.out System System.out " " + house[j][k][i] " " house[j][k][i] house[j][k] house[j] house j k i System.out.println() System.out.println System.out System System.out if(i != house[0][0].length-1) System.out.println("####################"); i != house[0][0].length-1 i house[0][0].length-1 house[0][0].length house[0][0] house[0] house 0 0 house[0][0].length 1 System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		}
	}

} public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) 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) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[][][] house = new int[3][10][4];
		String count = br.readLine();
		for(int i = 0 ; i < Integer.parseInt(count) ; i++){
			String info = br.readLine();
			String[] ia = info.split(" ");
			house[Integer.parseInt(ia[1])-1][Integer.parseInt(ia[2])-1][Integer.parseInt(ia[0])-1] += Integer.parseInt(ia[3]);
			                                                         
		}
		for(int i = 0 ; i < house[2][0].length ; i++){
			for(int j = 0 ; j < house.length ; j++){
				for(int k = 0 ; k < house[j].length ; k++){
					System.out.print(" " + house[j][k][i]);
				}
				System.out.println();
			}
			if(i != house[0][0].length-1) System.out.println("####################");
		}
	}

}