import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	}

} Main public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	} main {
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	} InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) int b b f f r r v; v int[][][] kousya = new int[4][3][10]; kousya new int[4][3][10] 4 3 10 for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	} {
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	} for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		} {
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		} for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
    				kousya[i][j][k] = 0;
    			} {
    				kousya[i][j][k] = 0;
    			} kousya[i][j][k] = 0 kousya[i][j][k] kousya[i][j] kousya[i] kousya i j k 0 String kensu = br.readLine(); kensu br.readLine() br.readLine br for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	} int i = 0; int i = 0; i 0 i < Integer.parseInt(kensu) i Integer.parseInt(kensu) Integer.parseInt Integer kensu i++ i++ i {
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	} {
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	} String[] nyukyo = br.readLine().split(" "); nyukyo br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " b = Integer.parseInt(nyukyo[0]) - 1 b Integer.parseInt(nyukyo[0]) - 1 Integer.parseInt(nyukyo[0]) Integer.parseInt Integer nyukyo[0] nyukyo 0 1 f = Integer.parseInt(nyukyo[1]) - 1 f Integer.parseInt(nyukyo[1]) - 1 Integer.parseInt(nyukyo[1]) Integer.parseInt Integer nyukyo[1] nyukyo 1 1 r = Integer.parseInt(nyukyo[2]) - 1 r Integer.parseInt(nyukyo[2]) - 1 Integer.parseInt(nyukyo[2]) Integer.parseInt Integer nyukyo[2] nyukyo 2 1 v = Integer.parseInt(nyukyo[3]) v Integer.parseInt(nyukyo[3]) Integer.parseInt Integer nyukyo[3] nyukyo 3 kousya[b][f][r] += v kousya[b][f][r] kousya[b][f] kousya[b] kousya b f r v for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	} {
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	} for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		} {
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		} for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			} {
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			} System.out.print(" ") System.out.print System.out System System.out " " System.out.print(kousya[i][j][k]) System.out.print System.out System System.out kousya[i][j][k] kousya[i][j] kousya[i] kousya i j k System.out.println() System.out.println System.out System System.out if (i != 3)
        			System.out.println("####################"); i != 3 i 3 System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	}

} public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
        int b, f, r, v;
    	int[][][] kousya = new int[4][3][10];
    	for (int i = 0; i < 4; i++)
    	{
    		for (int j = 0; j < 3; j++)
    		{
    			for (int k = 0; k < 10; k++)
    			{
    				kousya[i][j][k] = 0;
    			}
    		}
    	}
        	String kensu = br.readLine();
        	for (int i = 0; i < Integer.parseInt(kensu); i++)
        	{
            	String[] nyukyo = br.readLine().split(" ");
            		b = Integer.parseInt(nyukyo[0]) - 1;
            		f = Integer.parseInt(nyukyo[1]) - 1;
            		r = Integer.parseInt(nyukyo[2]) - 1;
            		v = Integer.parseInt(nyukyo[3]);
            		
            		kousya[b][f][r] += v;
        	}
        	for (int i = 0; i < 4; i++)
        	{
        		for (int j = 0; j < 3; j++)
        		{
        			for (int k = 0; k < 10; k++)
        			{
        				System.out.print(" ");
        				System.out.print(kousya[i][j][k]);
        			}
        			System.out.println();
        		}
        		if (i != 3)
        			System.out.println("####################");
        	}
        	
	}

}