import java.util.*;

public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

} import java.util.*; util.* java public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

} Main static int[][] tou1 = new int[3][10]; tou1 new int[3][10] 3 10 static int[][] tou2 = new int[3][10]; tou2 new int[3][10] 3 10 static int[][] tou3 = new int[3][10]; tou3 new int[3][10] 3 10 static int[][] tou4 = new int[3][10]; tou4 new int[3][10] 3 10 static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	} Output {
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	} for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		} int x = 0 ; int x = 0 ; x 0 x < 3 x 3 x++ x++ x {
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		} {
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		} for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			} int y = 0; int y = 0; y 0 y < 10 y 10 y++ y++ y {
				System.out.print(" " + tou[x][y]);
			} {
				System.out.print(" " + tou[x][y]);
			} System.out.print(" " + tou[x][y]) System.out.print System.out System System.out " " + tou[x][y] " " tou[x][y] tou[x] tou x y System.out.println() System.out.println System.out System System.out for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		} int i = 0 ; int i = 0 ; i 0 i < 20 i 20 i++ i++ i {
			if(last == 1){break;}
			System.out.print("#");
		} {
			if(last == 1){break;}
			System.out.print("#");
		} if(last == 1){break;} last == 1 last 1 {break;} break; System.out.print("#") System.out.print System.out System System.out "#" if (last != 1) {
			System.out.println();
		} last != 1 last 1 {
			System.out.println();
		} System.out.println() System.out.println System.out System System.out int[][] tou tou int last last static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	} Jouhou {
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	} switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		} b case 1: 1 case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v tou1[f-1][r-1] tou1[f-1] tou1 f-1 f 1 r-1 r 1 tou1[f-1][r-1]+v tou1[f-1][r-1] tou1[f-1] tou1 f-1 f 1 r-1 r 1 v break; case 2: 2 case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v tou2[f-1][r-1] tou2[f-1] tou2 f-1 f 1 r-1 r 1 tou2[f-1][r-1]+v tou2[f-1][r-1] tou2[f-1] tou2 f-1 f 1 r-1 r 1 v break; case 3: 3 case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v tou3[f-1][r-1] tou3[f-1] tou3 f-1 f 1 r-1 r 1 tou3[f-1][r-1]+v tou3[f-1][r-1] tou3[f-1] tou3 f-1 f 1 r-1 r 1 v break; case 4: 4 case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v tou4[f-1][r-1] tou4[f-1] tou4 f-1 f 1 r-1 r 1 tou4[f-1][r-1]+v tou4[f-1][r-1] tou4[f-1] tou4 f-1 f 1 r-1 r 1 v break; int b b int f f int r r int v v static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	} Input {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		} {
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		} int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int f = scanner.nextInt(); f scanner.nextInt() scanner.nextInt scanner int r = scanner.nextInt(); r scanner.nextInt() scanner.nextInt scanner int v = scanner.nextInt(); v scanner.nextInt() scanner.nextInt scanner Jouhou(b, f, r, v) Jouhou b f r v scanner.close() scanner.close scanner public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	} main {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	} Input() Input Output(tou1, 0) Output tou1 0 Output(tou2, 0) Output tou2 0 Output(tou3, 0) Output tou3 0 Output(tou4, 1) Output tou4 1 String[] args args public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

} public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

} Main
import java.util.*;

public class Main{

	static int[][] tou1 = new int[3][10];
	static int[][] tou2 = new int[3][10];
	static int[][] tou3 = new int[3][10];
	static int[][] tou4 = new int[3][10];
	
	static void Output(int[][] tou,int last){
		for(int x = 0 ; x < 3 ; x++){
			for(int y = 0; y < 10 ; y++){
				System.out.print(" " + tou[x][y]);
			}
			System.out.println();
		}
		for(int i = 0 ; i < 20 ; i++){
			if(last == 1){break;}
			System.out.print("#");
		}
		if (last != 1) {
			System.out.println();
		}
		
	}
	
	static void Jouhou(int b,int f,int r,int v){
		switch(b){ 
		case 1: tou1[f-1][r-1]=tou1[f-1][r-1]+v;	break;
		case 2: tou2[f-1][r-1]=tou2[f-1][r-1]+v;	break;
		case 3: tou3[f-1][r-1]=tou3[f-1][r-1]+v;	break;
		case 4: tou4[f-1][r-1]=tou4[f-1][r-1]+v;	break;
		}
	}
	
	
	static void Input(){
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		for(int i = 0; i < N ; i++){
			int b = scanner.nextInt();
			int f = scanner.nextInt();
			int r = scanner.nextInt();
			int v = scanner.nextInt();
			Jouhou(b, f, r, v);
		}
		scanner.close();
		
	}
	
	public static void main(String[] args) {
		Input();
		
		Output(tou1, 0);
		Output(tou2, 0);
		Output(tou3, 0);
		Output(tou4, 1);
	}

}