import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	}
}

class Room {
	
	private int residents;
	
	Room(int residents) {	
		this.residents	= residents;
	}
	
	public int getResidents() {
		return this.residents;
	}
	
	public void setResidents(int n) {
		this.residents += n;
		if (this.residents > 9) this.residents = 9;
		if (this.residents < 0) this.residents = 0;
	}
} import java.io.*; io.* java public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) final int B_TOTAL = 4; B_TOTAL 4 final int F_TOTAL = 3; F_TOTAL 3 final int R_TOTAL = 10; R_TOTAL 10 Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL]; univ_rooms new Room[B_TOTAL][F_TOTAL][R_TOTAL] B_TOTAL F_TOTAL R_TOTAL for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		} int i = 0; int i = 0; i 0 i < B_TOTAL i B_TOTAL i++ i++ i {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		} {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		} for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			} int j = 0; int j = 0; j 0 j < F_TOTAL j F_TOTAL j++ j++ j {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			} {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			} for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				} int k = 0; int k = 0; k 0 k < R_TOTAL k R_TOTAL k++ k++ k {
					univ_rooms[i][j][k] = new Room(0);
				} {
					univ_rooms[i][j][k] = new Room(0);
				} univ_rooms[i][j][k] = new Room(0) univ_rooms[i][j][k] univ_rooms[i][j] univ_rooms[i] univ_rooms i j k new Room(0) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = new String[4]; str new String[4] 4 int b b f f r r v; v for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		} {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		} str = br.readLine().split("\\s+") str br.readLine().split("\\s+") br.readLine().split br.readLine() br.readLine br "\\s+" b = Integer.parseInt(str[0]) b Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 f = Integer.parseInt(str[1]) f Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 r = Integer.parseInt(str[2]) r Integer.parseInt(str[2]) Integer.parseInt Integer str[2] str 2 v = Integer.parseInt(str[3]) v Integer.parseInt(str[3]) Integer.parseInt Integer str[3] str 3 univ_rooms[b - 1][f - 1][r - 1].setResidents(v) univ_rooms[b - 1][f - 1][r - 1].setResidents univ_rooms[b - 1][f - 1][r - 1] univ_rooms[b - 1][f - 1] univ_rooms[b - 1] univ_rooms b - 1 b 1 f - 1 f 1 r - 1 r 1 v for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		} int i = 0; int i = 0; i 0 i < univ_rooms.length i univ_rooms.length univ_rooms univ_rooms.length i++ i++ i {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		} {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		} for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			} int j = 0; int j = 0; j 0 j < univ_rooms[i].length j univ_rooms[i].length univ_rooms[i] univ_rooms i univ_rooms[i].length j++ j++ j {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			} {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			} for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				} int k = 0; int k = 0; k 0 k < univ_rooms[i][j].length k univ_rooms[i][j].length univ_rooms[i][j] univ_rooms[i] univ_rooms i j univ_rooms[i][j].length k++ k++ k {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				} {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				} System.out.print(" " + univ_rooms[i][j][k].getResidents()) System.out.print System.out System System.out " " + univ_rooms[i][j][k].getResidents() " " univ_rooms[i][j][k].getResidents() univ_rooms[i][j][k].getResidents univ_rooms[i][j][k] univ_rooms[i][j] univ_rooms[i] univ_rooms i j k System.out.println() System.out.println System.out System System.out if (i < univ_rooms.length - 1) System.out.println("####################"); i < univ_rooms.length - 1 i univ_rooms.length - 1 univ_rooms.length univ_rooms univ_rooms.length 1 System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args class Room {
	
	private int residents;
	
	Room(int residents) {	
		this.residents	= residents;
	}
	
	public int getResidents() {
		return this.residents;
	}
	
	public void setResidents(int n) {
		this.residents += n;
		if (this.residents > 9) this.residents = 9;
		if (this.residents < 0) this.residents = 0;
	}
} Room private int residents; residents Room(int residents) {	
		this.residents	= residents;
	} Room {	
		this.residents	= residents;
	} this.residents	= residents this.residents this this.residents residents int residents residents public int getResidents() {
		return this.residents;
	} getResidents {
		return this.residents;
	} return this.residents; this.residents this this.residents public void setResidents(int n) {
		this.residents += n;
		if (this.residents > 9) this.residents = 9;
		if (this.residents < 0) this.residents = 0;
	} setResidents {
		this.residents += n;
		if (this.residents > 9) this.residents = 9;
		if (this.residents < 0) this.residents = 0;
	} this.residents += n this.residents this this.residents n if (this.residents > 9) this.residents = 9; this.residents > 9 this.residents this this.residents 9 this.residents = 9 this.residents this this.residents 9 if (this.residents < 0) this.residents = 0; this.residents < 0 this.residents this this.residents 0 this.residents = 0 this.residents this this.residents 0 int n n public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	}
} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	}
} Main
import java.io.*;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		final int B_TOTAL = 4;
		final int F_TOTAL = 3;
		final int R_TOTAL = 10;
		Room[][][] univ_rooms = new Room[B_TOTAL][F_TOTAL][R_TOTAL];
		
		for (int i = 0; i < B_TOTAL; i++) {	
			for (int j = 0; j < F_TOTAL; j++) {
				for (int k = 0; k < R_TOTAL; k++) {
					univ_rooms[i][j][k] = new Room(0);
				}
			}
		}
		
		int n = Integer.parseInt(br.readLine());
		String[] str = new String[4];
		int b, f, r, v;
		for (int i = 0; i < n; i++) {
			str = br.readLine().split("\\s+");
			b = Integer.parseInt(str[0]);
			f = Integer.parseInt(str[1]);
			r = Integer.parseInt(str[2]);
			v = Integer.parseInt(str[3]);
			univ_rooms[b - 1][f - 1][r - 1].setResidents(v);
		}
		
		for (int i = 0; i < univ_rooms.length; i++) {
			for (int j = 0; j < univ_rooms[i].length; j++) {
				for (int k = 0; k < univ_rooms[i][j].length; k++) {
					System.out.print(" " + univ_rooms[i][j][k].getResidents());
				}
				System.out.println();
			}
			if (i < univ_rooms.length - 1) System.out.println("####################");
		}
		
	}
}

class Room {
	
	private int residents;
	
	Room(int residents) {	
		this.residents	= residents;
	}
	
	public int getResidents() {
		return this.residents;
	}
	
	public void setResidents(int n) {
		this.residents += n;
		if (this.residents > 9) this.residents = 9;
		if (this.residents < 0) this.residents = 0;
	}
}