
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -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 public class Main {
    public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    }
} Main public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    } main {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    } BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in)); reader new BufferedReader ( new InputStreamReader (System.in)) StringBuilder builder = new StringBuilder(); builder new StringBuilder() int[][][] room = new int[4][3][10]; room new int[4][3][10] 4 3 10 int MAX = 9; MAX 9 int MIN = 0; MIN 0 int dataCount = Integer.parseInt(reader.readLine()); dataCount Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int tou = 0; tou 0 int floor = 0; floor 0 int ban = 0; ban 0 int num = 0; num 0 int touMAX = 4; touMAX 4 int floorMAX = 3; floorMAX 3 int banMAX = 10; banMAX 10 for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        } int i = 0; int i = 0; i 0 i < dataCount i dataCount i++ i++ i {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        } {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        } String inputData = reader.readLine(); inputData reader.readLine() reader.readLine reader String[] inputCol = inputData.split(" "); inputCol inputData.split(" ") inputData.split inputData " " tou = Integer.parseInt(inputCol[0])-1 tou Integer.parseInt(inputCol[0])-1 Integer.parseInt(inputCol[0]) Integer.parseInt Integer inputCol[0] inputCol 0 1 floor = Integer.parseInt(inputCol[1])-1 floor Integer.parseInt(inputCol[1])-1 Integer.parseInt(inputCol[1]) Integer.parseInt Integer inputCol[1] inputCol 1 1 ban = Integer.parseInt(inputCol[2])-1 ban Integer.parseInt(inputCol[2])-1 Integer.parseInt(inputCol[2]) Integer.parseInt Integer inputCol[2] inputCol 2 1 num = Integer.parseInt(inputCol[3]) num Integer.parseInt(inputCol[3]) Integer.parseInt Integer inputCol[3] inputCol 3 if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            } room[tou][floor][ban] + num >= 9 room[tou][floor][ban] + num room[tou][floor][ban] room[tou][floor] room[tou] room tou floor ban num 9 room[tou][floor][ban] = MAX room[tou][floor][ban] room[tou][floor] room[tou] room tou floor ban MAX if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            } room[tou][floor][ban] + num <= 0 room[tou][floor][ban] + num room[tou][floor][ban] room[tou][floor] room[tou] room tou floor ban num 0 room[tou][floor][ban] = MIN room[tou][floor][ban] room[tou][floor] room[tou] room tou floor ban MIN {
                room[tou][floor][ban] += num;
            } room[tou][floor][ban] += num room[tou][floor][ban] room[tou][floor] room[tou] room tou floor ban num for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        } int x = 0; int x = 0; x 0 x < touMAX x touMAX x++ x++ x {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        } {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        } for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            } int y = 0 ; int y = 0 ; y 0 y < floorMAX y floorMAX y++ y++ y {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            } {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            } for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                } int z = 0 ; int z = 0 ; z 0 z < banMAX z banMAX z++ z++ z {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                } {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                } System.out.print(" ") System.out.print System.out System System.out " " System.out.print(room[x][y][z]) System.out.print System.out System System.out room[x][y][z] room[x][y] room[x] room x y z System.out.println("") System.out.println System.out System System.out "" if ( x != touMAX -1)
                System.out.println("####################"); x != touMAX -1 x touMAX -1 touMAX 1 System.out.println("####################") System.out.println System.out System System.out "####################" String[] args args public class Main {
    public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    }
} public class Main {
    public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    }
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main (String[] args ) throws IOException {
        BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
        StringBuilder builder = new StringBuilder();
        int[][][] room = new int[4][3][10];
        int MAX = 9;
        int MIN = 0;
        int dataCount = Integer.parseInt(reader.readLine());
        int tou = 0;
        int floor = 0;
        int ban = 0;
        int num = 0;
        int touMAX = 4;
        int floorMAX = 3;
        int banMAX = 10;
        
        for (int i = 0;i < dataCount; i++ ) {
            String inputData = reader.readLine();
            String[] inputCol = inputData.split(" ");
            
            tou = Integer.parseInt(inputCol[0])-1;
            floor = Integer.parseInt(inputCol[1])-1;
            ban = Integer.parseInt(inputCol[2])-1;
            num = Integer.parseInt(inputCol[3]);
            
            if ( room[tou][floor][ban] + num >= 9)
                room[tou][floor][ban] = MAX;
            else if ( room[tou][floor][ban] + num <= 0)
                room[tou][floor][ban] = MIN;
            else {
                room[tou][floor][ban] += num;
            }
        }
        
        for (int x = 0; x < touMAX ; x++ ) {
            for (int y = 0 ; y < floorMAX ; y++) {
                for (int z = 0 ; z < banMAX ; z++) {
                    System.out.print(" ");
                    System.out.print(room[x][y][z]);
                }
                System.out.println("");
            }
            if ( x != touMAX -1)
                System.out.println("####################");
        }
    }
}