import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{

		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		}
		int heya = 0;
		int tou1 [] = new int [31];
		int tou2 [] = new int [31];
		int tou3 [] = new int [31];
		int tou4 [] = new int [31];
		for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		}
		for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		}
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
	}
} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{

		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		}
		int heya = 0;
		int tou1 [] = new int [31];
		int tou2 [] = new int [31];
		int tou3 [] = new int [31];
		int tou4 [] = new int [31];
		for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		}
		for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		}
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{

		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		}
		int heya = 0;
		int tou1 [] = new int [31];
		int tou2 [] = new int [31];
		int tou3 [] = new int [31];
		int tou4 [] = new int [31];
		for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		}
		for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		}
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
	} main {

		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		}
		int heya = 0;
		int tou1 [] = new int [31];
		int tou2 [] = new int [31];
		int tou3 [] = new int [31];
		int tou4 [] = new int [31];
		for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		}
		for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		}
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) ArrayList<String> suite = new ArrayList<String>(); suite new ArrayList<String>() ArrayList<String> hikaku = new ArrayList<String>(); hikaku new ArrayList<String>() ArrayList<Integer> lb = new ArrayList<Integer>(); lb new ArrayList<Integer>() ArrayList<Integer> lf = new ArrayList<Integer>(); lf new ArrayList<Integer>() ArrayList<Integer> lr = new ArrayList<Integer>(); lr new ArrayList<Integer>() ArrayList<Integer> lv = new ArrayList<Integer>(); lv new ArrayList<Integer>() int n =scan.nextInt(); n scan.nextInt() scan.nextInt scan for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		} {
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		} int bb = scan.nextInt(); bb scan.nextInt() scan.nextInt scan int ff = scan.nextInt(); ff scan.nextInt() scan.nextInt scan int rr = scan.nextInt(); rr scan.nextInt() scan.nextInt scan int vv = scan.nextInt(); vv scan.nextInt() scan.nextInt scan lb.add(bb) lb.add lb bb lf.add(ff) lf.add lf ff lr.add(rr) lr.add lr rr lv.add(vv) lv.add lv vv int heya = 0; heya 0 int tou1 [] = new int [31]; tou1 new int [31] 31 int tou2 [] = new int [31]; tou2 new int [31] 31 int tou3 [] = new int [31]; tou3 new int [31] 31 int tou4 [] = new int [31]; tou4 new int [31] 31 for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		} int i =0; int i =0; i 0 i<31 i 31 i++ i++ i {
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		} {
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		} tou1[i] = 0 tou1[i] tou1 i 0 tou2[i] = 0 tou2[i] tou2 i 0 tou3[i] = 0 tou3[i] tou3 i 0 tou4[i] = 0 tou4[i] tou4 i 0 for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		} int i =0; int i =0; i 0 i<lb.size() i lb.size() lb.size lb i++ i++ i {
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		} {
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		} heya = 0 heya 0 heya += lr.get(i) heya lr.get(i) lr.get lr i heya += (lf.get(i) * 10 - 10) heya (lf.get(i) * 10 - 10) lf.get(i) * 10 lf.get(i) lf.get lf i 10 10 if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				} lb.get(i) == 1 lb.get(i) lb.get lb i 1 {
					tou1[heya] += lv.get(i);
				} tou1[heya] += lv.get(i) tou1[heya] tou1 heya lv.get(i) lv.get lv i if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				} lb.get(i) == 2 lb.get(i) lb.get lb i 2 {
					tou2[heya] += lv.get(i);
				} tou2[heya] += lv.get(i) tou2[heya] tou2 heya lv.get(i) lv.get lv i if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				} lb.get(i) == 3 lb.get(i) lb.get lb i 3 {
					tou3[heya] += lv.get(i);
				} tou3[heya] += lv.get(i) tou3[heya] tou3 heya lv.get(i) lv.get lv i if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				} lb.get(i) == 4 lb.get(i) lb.get lb i 4 {
					tou4[heya] += lv.get(i);
				} tou4[heya] += lv.get(i) tou4[heya] tou4 heya lv.get(i) lv.get lv i for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} int i = 1; int i = 1; i 1 i<31 i 31 i++ i++ i {
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} {
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} System.out.print(" "+tou1[i]) System.out.print System.out System System.out " "+tou1[i] " " tou1[i] tou1 i if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			} i == 10 || i == 20 || i == 30 i == 10 || i == 20 || i == 30 i == 10 i 10 i == 20 i 20 i == 30 i 30 {
				System.out.println("");
			} System.out.println("") System.out.println System.out System System.out "" System.out.println("####################") System.out.println System.out System System.out "####################" for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} int i = 1; int i = 1; i 1 i<31 i 31 i++ i++ i {
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} {
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} System.out.print(" "+tou2[i]) System.out.print System.out System System.out " "+tou2[i] " " tou2[i] tou2 i if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			} i == 10 || i == 20 || i == 30 i == 10 || i == 20 || i == 30 i == 10 i 10 i == 20 i 20 i == 30 i 30 {
				System.out.println("");
			} System.out.println("") System.out.println System.out System System.out "" System.out.println("####################") System.out.println System.out System System.out "####################" for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} int i = 1; int i = 1; i 1 i<31 i 31 i++ i++ i {
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} {
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} System.out.print(" "+tou3[i]) System.out.print System.out System System.out " "+tou3[i] " " tou3[i] tou3 i if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			} i == 10 || i == 20 || i == 30 i == 10 || i == 20 || i == 30 i == 10 i 10 i == 20 i 20 i == 30 i 30 {
				System.out.println("");
			} System.out.println("") System.out.println System.out System System.out "" System.out.println("####################") System.out.println System.out System System.out "####################" for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} int i = 1; int i = 1; i 1 i<31 i 31 i++ i++ i {
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} {
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		} System.out.print(" "+tou4[i]) System.out.print System.out System System.out " "+tou4[i] " " tou4[i] tou4 i if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			} i == 10 || i == 20 || i == 30 i == 10 || i == 20 || i == 30 i == 10 i 10 i == 20 i 20 i == 30 i 30 {
				System.out.println("");
			} System.out.println("") System.out.println System.out System System.out "" String[] args args
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{

		Scanner scan = new Scanner(System.in);
		ArrayList<String> suite = new ArrayList<String>();
		ArrayList<String> hikaku = new ArrayList<String>();
		ArrayList<Integer> lb = new ArrayList<Integer>();
		ArrayList<Integer> lf = new ArrayList<Integer>();
		ArrayList<Integer> lr = new ArrayList<Integer>();
		ArrayList<Integer> lv = new ArrayList<Integer>();
		int n =scan.nextInt();
		for(int i=0;i<n;i++){
			int bb = scan.nextInt();
			int ff = scan.nextInt();
			int rr = scan.nextInt();
			int vv = scan.nextInt();
			lb.add(bb);
			lf.add(ff);
			lr.add(rr);
			lv.add(vv);
		}
		int heya = 0;
		int tou1 [] = new int [31];
		int tou2 [] = new int [31];
		int tou3 [] = new int [31];
		int tou4 [] = new int [31];
		for(int i =0;i<31;i++){
			tou1[i] = 0;
			tou2[i] = 0;
			tou3[i] = 0;
			tou4[i] = 0;
		}
		for(int i =0;i<lb.size();i++){
				heya = 0;
				heya += lr.get(i);
				heya += (lf.get(i) * 10 - 10);
//				System.out.println(heya);
				if(lb.get(i) == 1){
					tou1[heya] += lv.get(i);
				}
				if(lb.get(i) == 2){
					tou2[heya] += lv.get(i);
				}
				if(lb.get(i) == 3){
					tou3[heya] += lv.get(i);
				}
				if(lb.get(i) == 4){
					tou4[heya] += lv.get(i);
				}
		}
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou1[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou2[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou3[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
		System.out.println("####################");
		for(int i = 1;i<31;i++){
			System.out.print(" "+tou4[i]);
			if(i == 10 || i == 20 || i == 30){
				System.out.println("");
			}
//			else{
//				System.out.print(" ");
//			}
		}
	}
}