import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		}
		
		
	} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		}
		
		
	} Main public static void main(String[] args) throws IOException {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		} main {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int t=sc.nextInt(); t sc.nextInt() sc.nextInt sc String type; type int b b f f r r v; v int[][][] tp=new int[5][4][11]; tp new int[5][4][11] 5 4 11 for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			} int i=0; int i=0; i 0 i<t i t i++ i++ i {
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			} {
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			} 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 tp[b][f][r]+=v tp[b][f][r] tp[b][f] tp[b] tp b f r v int x=tp[b][f][r]; x tp[b][f][r] tp[b][f] tp[b] tp b f r if(x<0)x=0;
			else if(x>10)x=9; x<0 x 0 x=0 x 0 if(x>10)x=9; x>10 x 10 x=9 x 9 tp[b][f][r]=x tp[b][f][r] tp[b][f] tp[b] tp b f r x sc.close() sc.close sc for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			} int i=1; int i=1; i 1 i<5 i 5 i++ i++ i {
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			} {
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			} for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				} int l = 1; int l = 1; l 1 l<4 l 4 l++ l++ l {
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				} {
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				} for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				} int m=1; int m=1; m 1 m<11 m 11 m++ m++ m {
					System.out.print(" "+tp[i][l][m]);
				} {
					System.out.print(" "+tp[i][l][m]);
				} System.out.print(" "+tp[i][l][m]) System.out.print System.out System System.out " "+tp[i][l][m] " " tp[i][l][m] tp[i][l] tp[i] tp i l m System.out.println() System.out.println System.out System System.out if(i!=4)System.out.println("####################"); i!=4 i 4 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 {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		}
		
		
	} public class Main {

	public static void main(String[] args) throws IOException {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		}
		
		
	} Main
import java.io.IOException;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) throws IOException {
		//File fi=new File("file.txt");

		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		 String type;
		 int b,f,r,v;
		 int[][][] tp=new int[5][4][11];
		for(int i=0;i<t;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			tp[b][f][r]+=v;
			int x=tp[b][f][r];
			if(x<0)x=0;
			else if(x>10)x=9;
			tp[b][f][r]=x;
			}sc.close();
		for(int i=1;i<5;i++){
			for(int l = 1;l<4;l++){
				for(int m=1;m<11;m++){
					System.out.print(" "+tp[i][l][m]);
				}System.out.println();				
				}if(i!=4)System.out.println("####################");
			}
		}
		
		
	}