import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 *

?????§?????????????????¢????????¨?±?????????????????????¬???????£??????????????????????????????¬????????\?±??????????????????±???????????????????????¨?±??????\?±??????°???????????????????????°?????????????????????????????????

n??¶????????±????????????????????????????????±??§?????????????????´??°b, f, r, v????????????????????????????????????b?£?f??????r???????????¨?±????v??????????????§??\?±????????????¨??????????????????v?????????????????´??????v????????????????????¨??????????????????

???????????¨????????¨?±?????????°?????\?±????????????????????????¨????????????

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C

 *
 *
 * @author wsKmatsuda
 *
 */
public class Main {

	public static void main(String[] args) {

		new Main().run();

	}


	public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * InputData?????????
	 * ?£????????????¨?±????????????\?±??????°?????????
	 */
	class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	}

	class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {

	public static void main(String[] args) {

		new Main().run();

	}


	public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * InputData?????????
	 * ?£????????????¨?±????????????\?±??????°?????????
	 */
	class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	}

	class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	}

} Main public static void main(String[] args) {

		new Main().run();

	} main {

		new Main().run();

	} new Main().run() new Main().run new Main() String[] args args public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	} run {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String inputData; inputData List<InputData> inputDataList = new ArrayList<InputData>(); inputDataList new ArrayList<InputData>() try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} int cardNum = Integer.parseInt(reader.readLine()); cardNum Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int cnt = 0; cnt 0 while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        } true {
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        } inputData = reader.readLine() inputData reader.readLine() reader.readLine reader String[] strData = inputData.split(" "); strData inputData.split(" ") inputData.split inputData " " inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3]))) inputDataList.add inputDataList new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])) cnt++ cnt if(cnt == cardNum){
	            	break;
	            } cnt == cardNum cnt cardNum {
	            	break;
	            } break; Collage collage = new Collage(); collage new Collage() for(InputData data :inputDataList){
	        	collage.setData(data);
	        } InputData data inputDataList {
	        	collage.setData(data);
	        } {
	        	collage.setData(data);
	        } collage.setData(data) collage.setData collage data collage.output() collage.output collage class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	} InputData //?£?
		public int b; b //???
		public int f; f //??¨?±???????
		public int r; r //??\?±??????°???????????´?????????????????°???
		public int v; v InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		} InputData {
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		} b = _b b _b f = _f f _f r = _r r _r v = _v v _v int _b _b int _f _f int _r _r int _v _v class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	} Collage int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		}; room {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		} {
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				} {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				} {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				} {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				} {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 {0,0,0,0,0,0,0,0,0,0} 0 0 0 0 0 0 0 0 0 0 /**
		 * ?????????????????????
		 */
		Collage(){

		} Collage {

		} /**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		} setData {

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		} room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v room[inputData.b-1][inputData.f-1][inputData.r-1] room[inputData.b-1][inputData.f-1] room[inputData.b-1] room inputData.b-1 inputData.b inputData inputData.b 1 inputData.f-1 inputData.f inputData inputData.f 1 inputData.r-1 inputData.r inputData inputData.r 1 inputData.v inputData inputData.v InputData inputData inputData /**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		} output {

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		} for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			} int bc = 0; int bc = 0; bc 0 bc < room.length bc room.length room room.length bc++ bc++ bc {
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			} {
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			} for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				} int fc=0; int fc=0; fc 0 fc < room[0].length fc room[0].length room[0] room 0 room[0].length fc++ fc++ fc {
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				} {
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				} for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					} int rc=0; int rc=0; rc 0 rc < room[0][0].length rc room[0][0].length room[0][0] room[0] room 0 0 room[0][0].length rc++ rc++ rc {
						System.out.print(" " + room[bc][fc][rc]);
					} {
						System.out.print(" " + room[bc][fc][rc]);
					} System.out.print(" " + room[bc][fc][rc]) System.out.print System.out System System.out " " + room[bc][fc][rc] " " room[bc][fc][rc] room[bc][fc] room[bc] room bc fc rc System.out.println() System.out.println System.out System System.out if(bc != room.length-1){
					System.out.println("####################");
				} bc != room.length-1 bc room.length-1 room.length room room.length 1 {
					System.out.println("####################");
				} System.out.println("####################") System.out.println System.out System System.out "####################" public class Main {

	public static void main(String[] args) {

		new Main().run();

	}


	public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * InputData?????????
	 * ?£????????????¨?±????????????\?±??????°?????????
	 */
	class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	}

	class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	}

} public class Main {

	public static void main(String[] args) {

		new Main().run();

	}


	public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * InputData?????????
	 * ?£????????????¨?±????????????\?±??????°?????????
	 */
	class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	}

	class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 *

?????§?????????????????¢????????¨?±?????????????????????¬???????£??????????????????????????????¬????????\?±??????????????????±???????????????????????¨?±??????\?±??????°???????????????????????°?????????????????????????????????

n??¶????????±????????????????????????????????±??§?????????????????´??°b, f, r, v????????????????????????????????????b?£?f??????r???????????¨?±????v??????????????§??\?±????????????¨??????????????????v?????????????????´??????v????????????????????¨??????????????????

???????????¨????????¨?±?????????°?????\?±????????????????????????¨????????????

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_C

 *
 *
 * @author wsKmatsuda
 *
 */
public class Main {

	public static void main(String[] args) {

		new Main().run();

	}


	public void run(){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String inputData;
        List<InputData> inputDataList = new ArrayList<InputData>();

        try {
        	int cardNum = Integer.parseInt(reader.readLine());
        	int cnt = 0;
        	//??\???
	        while(true){
				inputData = reader.readLine();
				String[] strData = inputData.split(" ");
				inputDataList.add(new InputData(Integer.parseInt(strData[0]) , Integer.parseInt(strData[1]) , Integer.parseInt(strData[2]),Integer.parseInt(strData[3])));
				cnt++;
	            if(cnt == cardNum){
	            	break;
	            }
	        }

	        //??\??????????¨????
	        Collage collage = new Collage();
	        for(InputData data :inputDataList){
	        	collage.setData(data);
	        }

	        //????????????
	        collage.output();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * InputData?????????
	 * ?£????????????¨?±????????????\?±??????°?????????
	 */
	class InputData{

		//?£?
		public int b;
		//???
		public int f;
		//??¨?±???????
		public int r;
		//??\?±??????°???????????´?????????????????°???
		public int v;

		InputData(int _b ,int _f,int _r,int _v){
			b = _b;
			f = _f;
			r = _r;
			v = _v;
		}
	}

	class Collage{

		int[][][] room = {
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
				{
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0},
					{0,0,0,0,0,0,0,0,0,0}
				},
		};

		/**
		 * ?????????????????????
		 */
		Collage(){

		}

		/**
		 * ??\????????????????¨??????????
		 * @param inputData
		 */
		public void setData(InputData inputData){

			room[inputData.b-1][inputData.f-1][inputData.r-1] += inputData.v;

		}

		/**
		 * ??????
		 */
		public void output(){

			for(int bc = 0;bc < room.length ; bc++){
				for(int fc=0;fc < room[0].length ; fc++){
					for(int rc=0;rc < room[0][0].length ; rc++){
						System.out.print(" " + room[bc][fc][rc]);
					}
					System.out.println();
				}
				if(bc != room.length-1){
					System.out.println("####################");
				}
			}

		}


	}

}