import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
/**
 * ??¶?´??????¶???????????????
 * @author B7078
 *
 */
class Exception{
	public static int ex(ArrayList<Integer> parse){
		int result = 1;
		if(parse.get(0)<1 || parse.get(0) > 4){
			result = 0;
		}
		else if(parse.get(1)<1 || parse.get(1) > 3){
			result = 0;
		}
		else if(parse.get(2)<1 || parse.get(2) > 10){
			result = 0;
		}
		else if(parse.get(3)<-9 || parse.get(3) > 9){
			result = 0;
		}
		return result;
	}
}
/**
 * ???????????????
 * @author B7078
 *
 */

public class Main {

	public static void main(String[] args) throws IOException{
		Exception ex1 = new Exception();
		int b, f, r, v; // b?£?,f???,r???????????¨?±?,v?????????
		int temp;
		int n;
		int count = 0;
		String str;
		ArrayList<String> st = new ArrayList<String>(); // ??\?????????????????????b,f,r,v
		ArrayList<Integer> parse = new ArrayList<Integer>(); // int??????
		int house[][][] = new int[4][3][10];
		/**
		 * ???????????\???
		 */
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt(); // ?????±??¶??°n?????\???

		for (int a = 0; a < n; ++a) { //??\?????¶??°????????????
			for (int t = 0; t < 4; t++) { // ??\??????????????????????????????????????????????´?
				st.add(scan.next());
			}

			for (int p = count; p < st.size(); ++p) {
				str = st.get(p);
				temp = Integer.parseInt(str);
				parse.add(temp);
				//System.out.println("parse["+p+"] = "+parse.get(p));
			}
			if(ex1.ex(parse) == 0){
				System.exit(0);
			}
			end:
			for (b = 1; b < 5; ++b) { // 4?£?
					for (f = 1; f < 4; ++f) { // 3????±?
							for (r = 1; r < 11; ++r) { // 1~10???????????¨?±?
								if(parse.get(count).equals(b) && parse.get(count+1).equals(f) && parse.get(count+2).equals(r)){
								house[b-1][f-1][r-1] += parse.get(count+3);
								}
								/*if(house[b-1][f-1][r-1] < 0 || house[b-1][f-1][r-1] > 9){ //?????¨?±?????????°??¶???
									System.out.println(" "+b+"?£?"+f+"???"+r+"???????????¨?±?????????°????????£??§??????????????????.");
									break end;
								}*/
								//System.out.print(" "+house[b-1][f-1][r-1]);
							}
							//System.out.println("");
						}
					//if(b<4)System.out.println("####################");
			}
			count += 4;
			}
		for(b = 1;b<5;++b){
			for(f = 1;f<4;++f){
				for(r = 1;r<11;++r){
					System.out.print(" "+house[b-1][f-1][r-1]);
				}
				System.out.println("");
			}
			if(b<4)System.out.println("####################");
		}
		}
		}
/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