import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	}
} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	} main {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	} int[] kou = new int[120]; kou new int[120] 120 for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		} int i = 0; int i = 0; i 0 i < 120 i 120 i++ i++ i {
			kou[i] = 0;
		} {
			kou[i] = 0;
		} kou[i] = 0 kou[i] kou i 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc int n = Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		} {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		} String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] kari1 = line.split(" "); kari1 line.split(" ") line.split line " " int[] kari2 = new int[4]; kari2 new int[4] 4 for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			} int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {
				kari2[j] = Integer.parseInt(kari1[j]);
			} {
				kari2[j] = Integer.parseInt(kari1[j]);
			} kari2[j] = Integer.parseInt(kari1[j]) kari2[j] kari2 j Integer.parseInt(kari1[j]) Integer.parseInt Integer kari1[j] kari1 j int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1); number (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1) (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1) (kari2[0] - 1) * 30 (kari2[0] - 1) kari2[0] kari2 0 1 30 (kari2[1] - 1) * 10 (kari2[1] - 1) kari2[1] kari2 1 1 10 (kari2[2] - 1) kari2[2] kari2 2 1 kou[number] += kari2[3] kou[number] kou number kari2[3] kari2 3 for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		} int i = 0; int i = 0; i 0 i < 120 i 120 i++ i++ i {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		} {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		} if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			} i == 119 i 119 {
				System.out.print(" ");
				System.out.println(kou[i]);
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println(kou[i]) System.out.println System.out System System.out kou[i] kou i if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			} (i + 1) % 30 == 0 (i + 1) % 30 (i + 1) i 1 30 0 {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println(kou[i]) System.out.println System.out System System.out kou[i] kou i System.out.println("####################") System.out.println System.out System System.out "####################" if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			} (i + 1) % 10 == 0 (i + 1) % 10 (i + 1) i 1 10 0 {
				System.out.print(" ");
				System.out.println(kou[i]);
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println(kou[i]) System.out.println System.out System System.out kou[i] kou i {
				System.out.print(" ");
				System.out.print(kou[i]);
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.print(kou[i]) System.out.print System.out System System.out kou[i] kou i String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	}
} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int[] kou = new int[120];
		for (int i = 0; i < 120; i++) {
			kou[i] = 0;
		}

		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		int n = Integer.parseInt(str);

		for (int i = 0; i < n; i++) {
			String line = sc.nextLine();
			String[] kari1 = line.split(" ");
			int[] kari2 = new int[4];
			for (int j = 0; j < 4; j++) {
				kari2[j] = Integer.parseInt(kari1[j]);
			}

			int number = (kari2[0] - 1) * 30 + (kari2[1] - 1) * 10
					+ (kari2[2] - 1);
			kou[number] += kari2[3];
		}

		for (int i = 0; i < 120; i++) {
			if (i == 119) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else if ((i + 1) % 30 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
				System.out.println("####################");
			} else if ((i + 1) % 10 == 0) {
				System.out.print(" ");
				System.out.println(kou[i]);
			} else {
				System.out.print(" ");
				System.out.print(kou[i]);
			}
		}

	}
}