import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		//Scanner????????????????????????
		Scanner scan = new Scanner(System.in);
		//??¶??°???????????????
		int n = scan.nextInt();
		//System.out.println("?????????????????????:" + n);

		//??\?±??????±???????´?????????????
		int[][] info = new int[n][4];
		//??¶??°?????°?????????
		for(int i = 0; i < n; i++){
			//j???[0]?£? [1]??? [2]??¨?±? [3]?????°
			for(int j = 0; j < 4; j++){

				info[i][j] = scan.nextInt();
			}

		}

		//???????????§??????????¬???????????????????
		int build = 4;
		int flor = 3;
		int room = 10;

		int [][][] ary = new int[build][flor][room];

		//??????????????????????????????????????£??\
		//?£??????°?????????
		for(int intB = 0; intB < build; intB++ ){

			//????????¢?????°?????????
			for(int intF = 0; intF < flor; intF++){

				//??????????????°?????????
				for(int intR = 0; intR < room; intR++){

					//?????????????????£??\
					ary[intB][intF][intR] = 0;
				}
			}
		}


		//?????±????????????????????????????????????
		//??¶??°?????°?????????
		for(int t = 0; t < n; t++){

			int b = info[t][0] - 1;//??????????????????????????????-1
			int f = info[t][1] - 1;
			int r = info[t][2] - 1;
			int p = info[t][3];
			ary[b][f][r] = ary[b][f][r] + p;

			//??\?±???????????????????????????£??????????????¨??????
			if(ary[b][f][r] < 0 ){
				ary[b][f][r] = 0;
			}
			//??\?±???????10??\???????????£?????????9??¨??????
			if(9 < ary[b][f][r] ){
				ary[b][f][r] = 9;
			}


		}




		//??????
		for(int intB = 0; intB < build; intB++ ){

			for(int intF = 0; intF < flor; intF++){

				for(int intR = 0; intR < room; intR++){

					System.out.print(" ");
					System.out.print(ary[intB][intF][intR]);

				}
				System.out.println("");
			}

			if(intB != build - 1){
			//?????????#?????????

				//?£???????????????¨??????20?????????
				for(int i =0; i < 20; i++){
					System.out.print("#");
				}
				System.out.println("");
			}

		}

	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz