import java.util.*;

class Main{
	public static void main(String args[]){
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	}
} import java.util.*; util.* java class Main{
	public static void main(String args[]){
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	}
} Main public static void main(String args[]){
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	} main {
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	} int[][] buil1 = new int[3][10]; buil1 new int[3][10] 3 10 int[][] buil2 = new int[3][10]; buil2 new int[3][10] 3 10 int[][] buil3 = new int[3][10]; buil3 new int[3][10] 3 10 int[][] buil4 = new int[3][10]; buil4 new int[3][10] 3 10 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		} int i=0; int i=0; i 0 i<num i num i++ i++ i {
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		} {
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		} switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			} scan.nextInt() scan.nextInt scan case 1: //A?£? 1 case 1: //A?£? buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt() buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] buil1[(scan.nextInt()-1)] buil1 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 scan.nextInt() scan.nextInt scan break; case 2: //B?£? 2 case 2: //B?£? buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt() buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] buil2[(scan.nextInt()-1)] buil2 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 scan.nextInt() scan.nextInt scan break; case 3: //C?£? 3 case 3: //C?£? buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt() buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] buil3[(scan.nextInt()-1)] buil3 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 scan.nextInt() scan.nextInt scan break; case 4: //D?£? 4 case 4: //D?£? buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt() buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] buil4[(scan.nextInt()-1)] buil4 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 (scan.nextInt()-1) scan.nextInt() scan.nextInt scan 1 scan.nextInt() scan.nextInt scan break; default : default : break; for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		} {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		} for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			} int k=0; int k=0; k 0 k<10 k 10 k++ k++ k {
				System.out.print(" " + buil1[i][k]);
			} {
				System.out.print(" " + buil1[i][k]);
			} System.out.print(" " + buil1[i][k]) System.out.print System.out System System.out " " + buil1[i][k] " " buil1[i][k] buil1[i] buil1 i k System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<20; i++){
			System.out.print("#");
		} int i=0; int i=0; i 0 i<20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		} {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		} for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			} int k=0; int k=0; k 0 k<10 k 10 k++ k++ k {
				System.out.print(" " + buil2[i][k]);
			} {
				System.out.print(" " + buil2[i][k]);
			} System.out.print(" " + buil2[i][k]) System.out.print System.out System System.out " " + buil2[i][k] " " buil2[i][k] buil2[i] buil2 i k System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<20; i++){
			System.out.print("#");
		} int i=0; int i=0; i 0 i<20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		} {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		} for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			} int k=0; int k=0; k 0 k<10 k 10 k++ k++ k {
				System.out.print(" " + buil3[i][k]);
			} {
				System.out.print(" " + buil3[i][k]);
			} System.out.print(" " + buil3[i][k]) System.out.print System.out System System.out " " + buil3[i][k] " " buil3[i][k] buil3[i] buil3 i k System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<20; i++){
			System.out.print("#");
		} int i=0; int i=0; i 0 i<20 i 20 i++ i++ i {
			System.out.print("#");
		} {
			System.out.print("#");
		} System.out.print("#") System.out.print System.out System System.out "#" System.out.println("") System.out.println System.out System System.out "" for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		} {
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		} for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			} int k=0; int k=0; k 0 k<10 k 10 k++ k++ k {
				System.out.print(" " + buil4[i][k]);
			} {
				System.out.print(" " + buil4[i][k]);
			} System.out.print(" " + buil4[i][k]) System.out.print System.out System System.out " " + buil4[i][k] " " buil4[i][k] buil4[i] buil4 i k System.out.println("") System.out.println System.out System System.out "" String args[] args
import java.util.*;

class Main{
	public static void main(String args[]){
		int[][] buil1 = new int[3][10];
		int[][] buil2 = new int[3][10];
		int[][] buil3 = new int[3][10];
		int[][] buil4 = new int[3][10];

		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();

		for(int i=0; i<num; i++){
			switch(scan.nextInt()){
				case 1: //A?£?
					buil1[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 2: //B?£?
					buil2[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 3: //C?£?
					buil3[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				case 4: //D?£?
					buil4[(scan.nextInt()-1)][(scan.nextInt()-1)] += scan.nextInt();
					break;
				default :
					break;
			}
		}
		//A?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil1[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//B?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil2[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//C?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil3[i][k]);
			}
			System.out.println("");
		}
		for(int i=0; i<20; i++){
			System.out.print("#");
		}
		System.out.println("");

		//D?£??????¨???
		for(int i=0; i<3; i++){
			for(int k=0; k<10; k++){
				System.out.print(" " + buil4[i][k]);
			}
			System.out.println("");
		}
	}
}