import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	} main {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> bData = new ArrayList<>(); bData new ArrayList<>() ArrayList<Integer> fData = new ArrayList<>(); fData new ArrayList<>() ArrayList<Integer> rData = new ArrayList<>(); rData new ArrayList<>() ArrayList<Integer> vData = new ArrayList<>(); vData new ArrayList<>() int firBuild[][] = new int[10][3]; firBuild new int[10][3] 10 3 int secoBuild[][] = new int[10][3]; secoBuild new int[10][3] 10 3 int thiBuild[][] = new int[10][3]; thiBuild new int[10][3] 10 3 int forBuild[][] = new int[10][3]; forBuild new int[10][3] 10 3 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int b b f f r r v = 0; v 0 for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		} {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		} 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 bData.add(b) bData.add bData b fData.add(f) fData.add fData f rData.add(r) rData.add rData r vData.add(v) vData.add vData v for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		} {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		} for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			} int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			} {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			} firBuild[i][j] = 0 firBuild[i][j] firBuild[i] firBuild i j 0 secoBuild[i][j] = 0 secoBuild[i][j] secoBuild[i] secoBuild i j 0 thiBuild[i][j] = 0 thiBuild[i][j] thiBuild[i] thiBuild i j 0 forBuild[i][j] = 0 forBuild[i][j] forBuild[i] forBuild i j 0 for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		} {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		} if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			} bData.get(i) == 1 bData.get(i) bData.get bData i 1 {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1] firBuild[rData.get(i)-1][fData.get(i)-1] firBuild[rData.get(i)-1] firBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1] vData.get(i) vData.get vData i firBuild[rData.get(i)-1][fData.get(i)-1] firBuild[rData.get(i)-1] firBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			} bData.get(i) == 2 bData.get(i) bData.get bData i 2 {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1] secoBuild[rData.get(i)-1][fData.get(i)-1] secoBuild[rData.get(i)-1] secoBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1] vData.get(i) vData.get vData i secoBuild[rData.get(i)-1][fData.get(i)-1] secoBuild[rData.get(i)-1] secoBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			} bData.get(i) == 3 bData.get(i) bData.get bData i 3 {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1] thiBuild[rData.get(i)-1][fData.get(i)-1] thiBuild[rData.get(i)-1] thiBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1] vData.get(i) vData.get vData i thiBuild[rData.get(i)-1][fData.get(i)-1] thiBuild[rData.get(i)-1] thiBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			} bData.get(i) == 4 bData.get(i) bData.get bData i 4 {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			} forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1] forBuild[rData.get(i)-1][fData.get(i)-1] forBuild[rData.get(i)-1] forBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1] vData.get(i) vData.get vData i forBuild[rData.get(i)-1][fData.get(i)-1] forBuild[rData.get(i)-1] forBuild rData.get(i)-1 rData.get(i) rData.get rData i 1 fData.get(i)-1 fData.get(i) fData.get fData i 1 for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		} int k  = 0; int k  = 0; k 0 k < 4 k 4 k++ k++ k {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		} {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		} for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			} {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			} for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				} int i = 0; int i = 0; i 0 i < 10 i 10 i++ i++ i {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				} {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				} if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					} k == 0 k 0 {
						System.out.print(" " + firBuild[i][j]);
					} System.out.print(" " + firBuild[i][j]) System.out.print System.out System System.out " " + firBuild[i][j] " " firBuild[i][j] firBuild[i] firBuild i j if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					} k == 1 k 1 {
						System.out.print(" " + secoBuild[i][j]);
					} System.out.print(" " + secoBuild[i][j]) System.out.print System.out System System.out " " + secoBuild[i][j] " " secoBuild[i][j] secoBuild[i] secoBuild i j if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					} k == 2 k 2 {
						System.out.print(" " + thiBuild[i][j]);
					} System.out.print(" " + thiBuild[i][j]) System.out.print System.out System System.out " " + thiBuild[i][j] " " thiBuild[i][j] thiBuild[i] thiBuild i j if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					} k == 3 k 3 {
						System.out.print(" " + forBuild[i][j]);
					} System.out.print(" " + forBuild[i][j]) System.out.print System.out System System.out " " + forBuild[i][j] " " forBuild[i][j] forBuild[i] forBuild i j System.out.println() System.out.println System.out System System.out if(k != 3) {
				System.out.println("####################");
			} k != 3 k 3 {
				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) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);

		ArrayList<Integer> bData = new ArrayList<>();
		ArrayList<Integer> fData = new ArrayList<>();
		ArrayList<Integer> rData = new ArrayList<>();
		ArrayList<Integer> vData = new ArrayList<>();
		
		int firBuild[][] = new int[10][3];
		int secoBuild[][] = new int[10][3];
		int thiBuild[][] = new int[10][3];
		int forBuild[][] = new int[10][3];
		
		//??\?????????
		int n = sc.nextInt();
		int b, f, r, v = 0;
		for(int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			v = sc.nextInt();
			bData.add(b);
			fData.add(f);
			rData.add(r);
			vData.add(v);
		}
		
		//???????????????
		for(int j = 0; j < 3; j++) {
			for(int i = 0; i < 10; i++) {
				firBuild[i][j] = 0;
				secoBuild[i][j] = 0;
				thiBuild[i][j] = 0;
				forBuild[i][j] = 0;
			}
		}
		
		//?????????????´?
		for(int i = 0; i < n; i++) {
			if(bData.get(i) == 1) {
				firBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + firBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 2) {
				secoBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + secoBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 3) {
				thiBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + thiBuild[rData.get(i)-1][fData.get(i)-1];
			} else if(bData.get(i) == 4) {
				forBuild[rData.get(i)-1][fData.get(i)-1] = vData.get(i) + forBuild[rData.get(i)-1][fData.get(i)-1];
			}
		}
		
		//??????
		for(int k  = 0; k < 4; k++) {
			for(int j = 0; j < 3; j++) {
				for(int i = 0; i < 10; i++) {
					if(k == 0) {
						System.out.print(" " + firBuild[i][j]);
					} else if(k == 1) {
						System.out.print(" " + secoBuild[i][j]);
					} else if(k == 2) {
						System.out.print(" " + thiBuild[i][j]);
					} else if(k == 3) {
						System.out.print(" " + forBuild[i][j]);
					}
				}
				System.out.println();
			}
			if(k != 3) {
				System.out.println("####################");
			}
		}
	}
}