

import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	}
} Main public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	} main {
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	} Scanner sc =  new Scanner(System.in); sc new Scanner(System.in) int [][][] list= new int[4][3][10]; list new int[4][3][10] 4 3 10 int b = 0; b 0 int f = 0; f 0 int r = 0; r 0 int v = 0; v 0 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		} {
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		} b = sc.nextInt() b sc.nextInt() sc.nextInt sc f = sc.nextInt() f sc.nextInt() sc.nextInt sc r = sc.nextInt() r sc.nextInt() sc.nextInt sc v = sc.nextInt() v sc.nextInt() sc.nextInt sc list [b -1][f-1][r-1] += v list [b -1][f-1][r-1] list [b -1][f-1] list [b -1] list b -1 b 1 f-1 f 1 r-1 r 1 v for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			} int i = 0; int i = 0; i 0 i <  4 i 4 i++ i++ i {
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			} {
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			} if(i != 0){
					System.out.println("####################");
				}else{
				} i != 0 i 0 {
					System.out.println("####################");
				} System.out.println("####################") System.out.println System.out System System.out "####################" {
				} for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				} {

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				} for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					} {
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					} if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						} k == 9 k 9 {
							System.out.println(" " + list[i][j][k]);
						} System.out.println(" " + list[i][j][k]) System.out.println System.out System System.out " " + list[i][j][k] " " list[i][j][k] list[i][j] list[i] list i j k {
							System.out.print(" " + list[i][j][k]);
						} System.out.print(" " + list[i][j][k]) System.out.print System.out System System.out " " + list[i][j][k] " " list[i][j][k] list[i][j] list[i] list i j k String []args args public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	}
} public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	}
} Main


import java.util.Scanner;

public class Main {
	public static void main(String []args){
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		//3?¬??????????????????????
		int [][][] list= new int[4][3][10];
		//??£?¨?
		int b = 0;
		int f = 0;
		int r = 0;
		int v = 0;
		//n??¶????????±
		int n = sc.nextInt();
			for(int i = 0; i<n;i++){
			//b?£? ?????±
			b = sc.nextInt();
			//?????? ?????±
			f = sc.nextInt();
			//r??????
			r = sc.nextInt();
			//v??? ?????±
			v = sc.nextInt();
			//??????????????????????´?
			list [b -1][f-1][r-1] += v;
		}
			//????´???????????????¨???
			for(int i = 0; i <  4;i++){
				if(i != 0){
					System.out.println("####################");
				}else{
				}
				for(int j = 0; j < 3; j++){

					for(int k = 0; k < 10; k++){
						//??????????????¨???
						if(k == 9){
							System.out.println(" " + list[i][j][k]);
						}else{
							System.out.print(" " + list[i][j][k]);
						}
					}
				}
			}
	}
}