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();
		}
	}
}


/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