import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[][][] oh = new int [4][3][10]; oh new int [4][3][10] 4 3 10 for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v;
		} {
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v;
		} String[] line =  br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int b = Integer.parseInt(line[0]); b Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int f = Integer.parseInt(line[1]); f Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int r = Integer.parseInt(line[2]); r Integer.parseInt(line[2]) Integer.parseInt Integer line[2] line 2 int v = Integer.parseInt(line[3]); v Integer.parseInt(line[3]) Integer.parseInt Integer line[3] line 3 b-- b f-- f r-- r if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v; (oh[b][f][r] + v) < 0 (oh[b][f][r] + v) oh[b][f][r] oh[b][f] oh[b] oh b f r v 0 oh[b][f][r] = 0 oh[b][f][r] oh[b][f] oh[b] oh b f r 0 if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[b][f][r] += v; (oh[b][f][r] + v) > 9 (oh[b][f][r] + v) oh[b][f][r] oh[b][f] oh[b] oh b f r v 9 oh[b][f][r] = 9 oh[b][f][r] oh[b][f] oh[b] oh b f r 9 oh[b][f][r] += v oh[b][f][r] oh[b][f] oh[b] oh 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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		} 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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		} {
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		} for(int j = 0; j < 3; j++){
				for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
				for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			} {
				for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			} for(int k = 0; k < 10; k++){
					sb.append(" ").append(oh[i][j][k]);
				} int k = 0; int k = 0; k 0 k < 10 k 10 k++ k++ k {
					sb.append(" ").append(oh[i][j][k]);
				} {
					sb.append(" ").append(oh[i][j][k]);
				} sb.append(" ").append(oh[i][j][k]) sb.append(" ").append sb.append(" ") sb.append sb " " oh[i][j][k] oh[i][j] oh[i] oh i j k sb.append("\n") sb.append sb "\n" if(i < 3)sb.append("####################").append("\n"); i < 3 i 3 sb.append("####################").append("\n") sb.append("####################").append sb.append("####################") sb.append sb "####################" "\n" System.out.print(sb) System.out.print System.out System System.out sb String[] args args public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
} public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = Integer.parseInt(br.readLine());
		int[][][] oh = new int [4][3][10];
		for(int i = 0; i < n; i++){
			String[] line =  br.readLine().split(" ");
			int b = Integer.parseInt(line[0]);
			int f = Integer.parseInt(line[1]);
			int r = Integer.parseInt(line[2]);
			int v = Integer.parseInt(line[3]);
			b--;
			f--;
			r--;
			if( (oh[b][f][r] + v) < 0) oh[b][f][r] = 0;
                        else if( (oh[b][f][r] + v) > 9) oh[b][f][r] = 9;
                        else oh[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++){
					sb.append(" ").append(oh[i][j][k]);
				}
				sb.append("\n");
			}
			if(i < 3)sb.append("####################").append("\n");
		}
		System.out.print(sb);
	}
}