

import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int n, b, f, r, v, c;
		int i = 0;
		c = 0;// ?????¶?????????????????????
		n = scan.nextInt();
		StringBuilder sb = new StringBuilder();
		List<Integer> list = new ArrayList<Integer>();
		// ?????????????????????????????±???????????\???????????§????????????
		// ???????????????????????±?????\?????????
		for (; i < 120; i++) {
			list.add(0);
		}

		for (int count = 0; count < n; count++) {// n??????????????????
			b = scan.nextInt();
			f = scan.nextInt();
			r = scan.nextInt();
			v = scan.nextInt();

			// ?£?????????? ???1?£??¢????????????¨???+30 ???1?£?????±0
			if (b == 1) {// 1?£?
				// ????????¢ ???1????????¢?¢????????????¨???+10 ???1????????¢????±0
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 20 + r - 1;
				}
			} else if (b == 2) {// 2?£? +30??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 30 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 30 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 30 + 20 + r - 1;
				}
			} else if (b == 3) {// 3?£? +60??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 60 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 60 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 60 + 20 + r - 1;
				}
			} else if (b == 4) {// 4?£? +90??????
				if (f == 1) {// ????????¢???
					// ??¨?±?????????????1~10
					c = 90 + r - 1;// ??¨?±????????????????????????????????????????
				} else if (f == 2) {// ????????¢2
					c = 90 + 10 + r - 1;
				} else if (f == 3) {// ????????¢3
					c = 90 + 20 + r - 1;
				}

			}
			if (list.get(c) != 0) {// 0??\??????????????¨?????????????????¨???????????????
				list.set(c, list.get(c) + v);
			} else {
				list.set(c, v);
			}

		}

		// ?????????????????????StringBuilder?????\??????
		i = 0;
		sb.append(" ");
		for (; i < 120; i++) {
			if ((i) % 10 == 0) {// 10???????????????
				if ((i) % 30 == 0) {// 30????????????#?????????????????\
					if (i != 0) {
						sb.append("\n");
						sb.append("####################");
						sb.append("\n");
						sb.append(" ");
					}
				} else {
					sb.append("\n");
					sb.append(" ");
				}
			}
			sb.append(list.get(i));
			if ((i) % 10 == 9) {
			} else {
				sb.append(" ");
			}
		}

		System.out.println(new String(sb));

	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz