import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] b = new int[n]; b new int[n] n int[] f = new int [n]; f new int [n] n int[] r = new int [n]; r new int [n] n int[] v = new int [n]; v new int [n] n for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		} int a = 0; int a = 0; a 0 a<n a n a++ a++ a {
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		} {
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		} b[a] = scan.nextInt() b[a] b a scan.nextInt() scan.nextInt scan f[a] = scan.nextInt() f[a] f a scan.nextInt() scan.nextInt scan r[a] = scan.nextInt() r[a] r a scan.nextInt() scan.nextInt scan v[a] = scan.nextInt() v[a] v a scan.nextInt() scan.nextInt scan int V[] = new int[120]; V new int[120] 120 int ka = 0; ka 0 for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		} int g = 0; int g = 0; g 0 g<n g n g++ g++ g {
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		} {
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		} for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			} int h = 1; int h = 1; h 1 h<=4 h 4 h++ h++ h {
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			} {
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			} for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				} int i = 1; int i = 1; i 1 i<=3 i 3 i++ i++ i {
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				} {
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				} for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					} int j = 1; int j = 1; j 1 j<=10 j 10 j++ j++ j {
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					} {
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					} if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						} b[g] == h && f[g] == i && r[g] == j b[g] == h && f[g] == i && r[g] == j b[g] == h b[g] b g h f[g] == i f[g] f g i r[g] == j r[g] r g j {
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						} V[ka*10+j-1] = V[ka*10+j-1] + v[g] V[ka*10+j-1] V ka*10+j-1 ka*10+j ka*10 ka 10 j 1 V[ka*10+j-1] + v[g] V[ka*10+j-1] V ka*10+j-1 ka*10+j ka*10 ka 10 j 1 v[g] v g ka++ ka ka = 0 ka 0 int kb =0; kb 0 for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		} int e =1; int e =1; e 1 e<=4 e 4 e++ e++ e {
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		} {
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		} for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			} int c =1; int c =1; c 1 c<=3 c 3 c++ c++ c {
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			} {
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			} for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				} int d = 1; int d = 1; d 1 d<=10 d 10 d++ d++ d {
					System.out.print(" "+V[kb*10+d-1]);
				} {
					System.out.print(" "+V[kb*10+d-1]);
				} System.out.print(" "+V[kb*10+d-1]) System.out.print System.out System System.out " "+V[kb*10+d-1] " " V[kb*10+d-1] V kb*10+d-1 kb*10+d kb*10 kb 10 d 1 System.out.println("") System.out.println System.out System System.out "" kb++ kb if(e != 4){
				System.out.println("####################");
			} e != 4 e 4 {
				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 scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	}
} public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] b = new int[n];
		int[] f = new int [n];
		int[] r = new int [n];
		int[] v = new int [n];
		for(int a = 0;a<n;a++){
			b[a] = scan.nextInt();
			f[a] = scan.nextInt();
			r[a] = scan.nextInt();
			v[a] = scan.nextInt();
		}
		int V[] = new int[120];
		int ka = 0;
		for(int g = 0;g<n;g++){
			for(int h = 1;h<=4;h++){
				for(int i = 1;i<=3;i++){
					for(int j = 1;j<=10;j++){
						if(b[g] == h && f[g] == i && r[g] == j){
							V[ka*10+j-1] = V[ka*10+j-1] + v[g];
						}
					}
					ka++;
				}
			}
			ka = 0;
		}
		int kb =0;
		for(int e =1;e<=4;e++){
			for(int c =1;c<=3;c++){
				for(int d = 1;d<=10;d++){
					System.out.print(" "+V[kb*10+d-1]);
				}
				System.out.println("");
				kb++;
			}
			if(e != 4){
				System.out.println("####################");
			}
		}
	}
}