import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	} main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String buffer; buffer int amount = 0; amount 0 int count = 0; count 0 byte[][][] buildings = new byte[4][3][10]; buildings new byte[4][3][10] 4 3 10 try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		} catch (Exception ex) {
			ex.printStackTrace();
		} Exception ex {
			ex.printStackTrace();
		} ex.printStackTrace() ex.printStackTrace ex {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			} (buffer = reader.readLine())  != null (buffer = reader.readLine()) buffer reader.readLine() reader.readLine reader null {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			} String[] strings = buffer.split(" "); strings buffer.split(" ") buffer.split buffer " " if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				} amount == 0 amount 0 {
					amount = Integer.valueOf(strings[0]);
				} amount = Integer.valueOf(strings[0]) amount Integer.valueOf(strings[0]) Integer.valueOf Integer strings[0] strings 0 {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				} int b = Integer.valueOf(strings[0]); b Integer.valueOf(strings[0]) Integer.valueOf Integer strings[0] strings 0 int f = Integer.valueOf(strings[1]); f Integer.valueOf(strings[1]) Integer.valueOf Integer strings[1] strings 1 int r = Integer.valueOf(strings[2]); r Integer.valueOf(strings[2]) Integer.valueOf Integer strings[2] strings 2 int v = Integer.valueOf(strings[3]); v Integer.valueOf(strings[3]) Integer.valueOf Integer strings[3] strings 3 buildings[b - 1][f - 1][r - 1] += v buildings[b - 1][f - 1][r - 1] buildings[b - 1][f - 1] buildings[b - 1] buildings b - 1 b 1 f - 1 f 1 r - 1 r 1 v if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					} ++count >= amount ++count count amount {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					} for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						} byte building = 0; byte building = 0; building 0 building < 4 building 4 building++ building++ building {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						} {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						} for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							} byte floor = 0; byte floor = 0; floor 0 floor < 3 floor 3 floor++ floor++ floor {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							} {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							} for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								} byte room = 0; byte room = 0; room 0 room < 10 room 10 room++ room++ room {
									System.out.print(" " + buildings[building][floor][room]);
								} {
									System.out.print(" " + buildings[building][floor][room]);
								} System.out.print(" " + buildings[building][floor][room]) System.out.print System.out System System.out " " + buildings[building][floor][room] " " buildings[building][floor][room] buildings[building][floor] buildings[building] buildings building floor room System.out.println() System.out.println System.out System System.out if (building < 3) {
								System.out.println("####################");
							} building < 3 building 3 {
								System.out.println("####################");
							} System.out.println("####################") System.out.println System.out System System.out "####################" return; String[] args args public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
} public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

