import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    }
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br str =br.readLine() str br.readLine() br.readLine br int touA[][]= new int[3][10]; touA new int[3][10] 3 10 int touB[][]; touB touB = new int[3][10] touB new int[3][10] 3 10 int touC[][]; touC touC = new int[3][10] touC new int[3][10] 3 10 int touD[][]; touD touD = new int[3][10] touD new int[3][10] 3 10 while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            } str != null str null {

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            } String[] line = str.split("\\s"); line str.split("\\s") str.split str "\\s" int b = Integer.parseInt(line[0]); b Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int f = Integer.parseInt(line[1]); f Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int r = Integer.parseInt(line[2]); r Integer.parseInt(line[2]) Integer.parseInt Integer line[2] line 2 int v = Integer.parseInt(line[3]); v Integer.parseInt(line[3]) Integer.parseInt Integer line[3] line 3 if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } b == 1 b 1 {
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } int tempn; tempn tempn = touA[f-1][r-1] tempn touA[f-1][r-1] touA[f-1] touA f-1 f 1 r-1 r 1 tempn += v tempn v touA[f-1][r-1] = tempn touA[f-1][r-1] touA[f-1] touA f-1 f 1 r-1 r 1 tempn if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } b == 2 b 2 {
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } int tempn; tempn tempn = touB[f-1][r-1] tempn touB[f-1][r-1] touB[f-1] touB f-1 f 1 r-1 r 1 tempn += v tempn v touB[f-1][r-1] = tempn touB[f-1][r-1] touB[f-1] touB f-1 f 1 r-1 r 1 tempn if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } b == 3 b 3 {
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } int tempn ; tempn tempn = touC[f-1][r-1] tempn touC[f-1][r-1] touC[f-1] touC f-1 f 1 r-1 r 1 tempn += v tempn v touC[f-1][r-1] = tempn touC[f-1][r-1] touC[f-1] touC f-1 f 1 r-1 r 1 tempn if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } b == 4 b 4 {
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                } int tempn ; tempn tempn = touD[f-1][r-1] tempn touD[f-1][r-1] touD[f-1] touD f-1 f 1 r-1 r 1 tempn += v tempn v touD[f-1][r-1] = tempn touD[f-1][r-1] touD[f-1] touD f-1 f 1 r-1 r 1 tempn str = br.readLine() str br.readLine() br.readLine br StringBuilder out = new StringBuilder(); out new StringBuilder() for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                } int j =0; int j =0; j 0 j<10 j 10 j++ j++ j {
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                } {
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                } String x = String.valueOf(touA[i][j]); x String.valueOf(touA[i][j]) String.valueOf String touA[i][j] touA[i] touA i j out.append(" ") out.append out " " out.append(x) out.append out x out.append("\n") out.append out "\n" out.append("####################") out.append out "####################" out.append("\n") out.append out "\n" for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                } int j =0; int j =0; j 0 j<10 j 10 j++ j++ j {
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                } {
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                } String x = String.valueOf(touB[i][j]); x String.valueOf(touB[i][j]) String.valueOf String touB[i][j] touB[i] touB i j out.append(" ") out.append out " " out.append(x) out.append out x out.append("\n") out.append out "\n" out.append("####################") out.append out "####################" out.append("\n") out.append out "\n" for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            } for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                } int j =0; int j =0; j 0 j<10 j 10 j++ j++ j {
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                } {
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                } String x = String.valueOf(touC[i][j]); x String.valueOf(touC[i][j]) String.valueOf String touC[i][j] touC[i] touC i j out.append(" ") out.append out " " out.append(x) out.append out x out.append("\n") out.append out "\n" out.append("####################") out.append out "####################" out.append("\n") out.append out "\n" for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            } {
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            } for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                } int j =0; int j =0; j 0 j<10 j 10 j++ j++ j {
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                } {
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                } String x = String.valueOf(touD[i][j]); x String.valueOf(touD[i][j]) String.valueOf String touD[i][j] touD[i] touD i j out.append(" ") out.append out " " out.append(x) out.append out x if(i ==2){
                    break;
                }else{
                out.append("\n");
                } i ==2 i 2 {
                    break;
                } break; {
                out.append("\n");
                } out.append("\n") out.append out "\n" System.out.println(out.toString()) System.out.println System.out System System.out out.toString() out.toString out String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    }
} public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    }
} Main
import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        str =br.readLine();

        int touA[][]= new int[3][10];
        
        int touB[][];
        touB = new int[3][10];

        int touC[][];
        touC = new int[3][10];

        int touD[][];
        touD = new int[3][10];



            while(str != null){

            String[] line = str.split("\\s");

            int b = Integer.parseInt(line[0]);
            int f = Integer.parseInt(line[1]);
            int r = Integer.parseInt(line[2]);
            int v = Integer.parseInt(line[3]);

                if(b == 1){
                    int tempn;
                    tempn = touA[f-1][r-1];
                    tempn += v;
                    touA[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 2){
                    int tempn;
                    tempn = touB[f-1][r-1];
                    tempn += v;
                    touB[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 3){
                    int tempn ;
                    tempn = touC[f-1][r-1];
                    tempn += v;
                    touC[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                if(b == 4){
                    int tempn ;
                    tempn = touD[f-1][r-1];
                    tempn += v;
                    touD[f-1][r-1] = tempn;
                //System.out.println(tempn);
                }
                str = br.readLine();

            }

            StringBuilder out = new StringBuilder();
            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touA[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touB[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");                        

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touC[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                out.append("\n");
            }
            out.append("####################");
            out.append("\n");

            for(int i=0;i<3;i++){
                for(int j =0;j<10;j++){
                    String x = String.valueOf(touD[i][j]);
                    out.append(" ");
                    out.append(x);
                }
                if(i ==2){
                    break;
                }else{
                out.append("\n");
                }
            }
            
            System.out.println(out.toString());
    }
}