import java.util.Scanner;
public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
} Main private static final int MAX_B=4; MAX_B 4 private static final int MAX_F=3; MAX_F 3 private static final int MAX_R=10; MAX_R 10 private static Scanner sc=new Scanner(System.in); sc new Scanner(System.in) private static int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc private static int[][][] room=new int[MAX_B][MAX_F][MAX_R]; room new int[MAX_B][MAX_F][MAX_R] MAX_B MAX_F MAX_R public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	} main {
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	} for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		} int i=0; int i=0; i 0 i<MAX_B i MAX_B i++ i++ i {
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		} {
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		} for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			} int j=0; int j=0; j 0 j<MAX_F j MAX_F j++ j++ j {
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			} {
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			} for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				} int k=0; int k=0; k 0 k<MAX_R k MAX_R k++ k++ k {
					room[i][j][k]=0;
				} {
					room[i][j][k]=0;
				} room[i][j][k]=0 room[i][j][k] room[i][j] room[i] room i j k 0 int b b f f r r v; v for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=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();
			room[b-1][f-1][r-1]+=v;
		} {
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=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 room[b-1][f-1][r-1]+=v room[b-1][f-1][r-1] room[b-1][f-1] room[b-1] room b-1 b 1 f-1 f 1 r-1 r 1 v for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		} int i=0; int i=0; i 0 i<MAX_B-1 i MAX_B-1 MAX_B 1 i++ i++ i {
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		} {
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		} for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			} int j=0; int j=0; j 0 j<MAX_F j MAX_F j++ j++ j {
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			} {
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			} for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				} int k=0; int k=0; k 0 k<MAX_R k MAX_R k++ k++ k {
					System.out.print(" "+room[i][j][k]);
				} {
					System.out.print(" "+room[i][j][k]);
				} System.out.print(" "+room[i][j][k]) System.out.print System.out System System.out " "+room[i][j][k] " " room[i][j][k] room[i][j] room[i] room i j k System.out.println("") System.out.println System.out System System.out "" System.out.println("####################") System.out.println System.out System System.out "####################" for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		} int j=0; int j=0; j 0 j<MAX_F j MAX_F j++ j++ j {
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		} {
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		} for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			} int k=0; int k=0; k 0 k<MAX_R k MAX_R k++ k++ k {
				System.out.print(" "+room[3][j][k]);
			} {
				System.out.print(" "+room[3][j][k]);
			} System.out.print(" "+room[3][j][k]) System.out.print System.out System System.out " "+room[3][j][k] " " room[3][j][k] room[3][j] room[3] room 3 j k System.out.println("") System.out.println System.out System System.out "" String[] args args public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
} public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
} Main
import java.util.Scanner;
public class Main {
	private static final int MAX_B=4;
	private static final int MAX_F=3;
	private static final int MAX_R=10;
	private static Scanner sc=new Scanner(System.in);
	private static int n=sc.nextInt();
	private static int[][][] room=new int[MAX_B][MAX_F][MAX_R];
	public static void main(String[] args){
		for(int i=0;i<MAX_B;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					room[i][j][k]=0;
				}
			}
		}
		int b,f,r,v;
		for(int i=0;i<n;i++){
			b=sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			room[b-1][f-1][r-1]+=v;
		}
		for(int i=0;i<MAX_B-1;i++){
			for(int j=0;j<MAX_F;j++){
				for(int k=0;k<MAX_R;k++){
					System.out.print(" "+room[i][j][k]);
				}
				System.out.println("");
			}
			System.out.println("####################");
		}
		for(int j=0;j<MAX_F;j++){
			for(int k=0;k<MAX_R;k++){
				System.out.print(" "+room[3][j][k]);
			}
			System.out.println("");
		}
	}
}