import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	}

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws IOException {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	}

} Main public static void main(String[] args) throws IOException {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	} main {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	} int[][][] OHouse=new int [4][3][10]; OHouse new int [4][3][10] 4 3 10 for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		} int z=0; int z=0; z 0 z<4 z 4 z++ z++ z {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		} {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		} for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			} int y=0; int y=0; y 0 y<3 y 3 y++ y++ y {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			} {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			} for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				} int x=0; int x=0; x 0 x<10 x 10 x++ x++ x {
					OHouse[z][y][x]=0;
				} {
					OHouse[z][y][x]=0;
				} OHouse[z][y][x]=0 OHouse[z][y][x] OHouse[z][y] OHouse[z] OHouse z y x 0 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int count=1; count 1 while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		} n>=count n count {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		} StringTokenizer st=new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int b=Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int f=Integer.parseInt(st.nextToken()); f Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int r=Integer.parseInt(st.nextToken()); r Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int v=Integer.parseInt(st.nextToken()); v Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v OHouse[b-1][f-1][r-1] OHouse[b-1][f-1] OHouse[b-1] OHouse b-1 b 1 f-1 f 1 r-1 r 1 OHouse[b-1][f-1][r-1]+v OHouse[b-1][f-1][r-1] OHouse[b-1][f-1] OHouse[b-1] OHouse b-1 b 1 f-1 f 1 r-1 r 1 v if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			} OHouse[b-1][f-1][r-1]<0 OHouse[b-1][f-1][r-1] OHouse[b-1][f-1] OHouse[b-1] OHouse b-1 b 1 f-1 f 1 r-1 r 1 0 {
				OHouse[b-1][f-1][r-1]=0;
			} OHouse[b-1][f-1][r-1]=0 OHouse[b-1][f-1][r-1] OHouse[b-1][f-1] OHouse[b-1] OHouse b-1 b 1 f-1 f 1 r-1 r 1 0 count++ count for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		} int z=0; int z=0; z 0 z<4 z 4 z++ z++ z {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		} {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		} for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			} int y=0; int y=0; y 0 y<3 y 3 y++ y++ y {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			} {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			} for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				} int x=0; int x=0; x 0 x<10 x 10 x++ x++ x {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				} {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				} System.out.print(" "+OHouse[z][y][x]) System.out.print System.out System System.out " "+OHouse[z][y][x] " " OHouse[z][y][x] OHouse[z][y] OHouse[z] OHouse z y x if(x==9) {
						System.out.println("");
					} x==9 x 9 {
						System.out.println("");
					} System.out.println("") System.out.println System.out System System.out "" if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			} z<3 z 3 {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			} for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				} int i=0; int i=0; i 0 i<20 i 20 i++ i++ i {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				} {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				} System.out.print("#") System.out.print System.out System System.out "#" if(i==19) {
						System.out.println("");
					} i==19 i 19 {
						System.out.println("");
					} 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 {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		//配列の作成
		int[][][] OHouse=new int [4][3][10];
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					OHouse[z][y][x]=0;
				}
			}
		}

		//配列の加工(入力処理)
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int count=1;

		while(n>=count) {
			StringTokenizer st=new StringTokenizer(br.readLine());
			int b=Integer.parseInt(st.nextToken());
			int f=Integer.parseInt(st.nextToken());
			int r=Integer.parseInt(st.nextToken());
			int v=Integer.parseInt(st.nextToken());
			OHouse[b-1][f-1][r-1]=OHouse[b-1][f-1][r-1]+v;
			if(OHouse[b-1][f-1][r-1]<0) {
				OHouse[b-1][f-1][r-1]=0;
			}
			count++;
		}

		//配列の出力
		for(int z=0;z<4;z++) {
			for(int y=0;y<3;y++) {
				for(int x=0;x<10;x++) {
					System.out.print(" "+OHouse[z][y][x]);
					if(x==9) {
						System.out.println("");
					}
				}
			}
			if(z<3) {
				for(int i=0;i<20;i++) {
					System.out.print("#");
					if(i==19) {
						System.out.println("");
					}
				}
			}
		}
	}

}

