import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int[][][] rooms = new int[4][3][10]; rooms new int[4][3][10] 4 3 10 int max = scanner.nextInt(); max scanner.nextInt() scanner.nextInt scanner int b b f f r r v; v for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        } int i = 0; int i = 0; i 0 i < max i max i++ i++ i {
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        } {
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        } b = scanner.nextInt() b scanner.nextInt() scanner.nextInt scanner f = scanner.nextInt() f scanner.nextInt() scanner.nextInt scanner r = scanner.nextInt() r scanner.nextInt() scanner.nextInt scanner v = scanner.nextInt() v scanner.nextInt() scanner.nextInt scanner rooms[b-1][f-1][r-1] += v rooms[b-1][f-1][r-1] rooms[b-1][f-1] rooms[b-1] rooms b-1 b 1 f-1 f 1 r-1 r 1 v if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            } rooms[b-1][f-1][r-1] < 0 rooms[b-1][f-1][r-1] rooms[b-1][f-1] rooms[b-1] rooms b-1 b 1 f-1 f 1 r-1 r 1 0 {
                rooms[b-1][f-1][r-1] = 0;
            } rooms[b-1][f-1][r-1] = 0 rooms[b-1][f-1][r-1] rooms[b-1][f-1] rooms[b-1] rooms b-1 b 1 f-1 f 1 r-1 r 1 0 if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            } rooms[b-1][f-1][r-1] > 9 rooms[b-1][f-1][r-1] rooms[b-1][f-1] rooms[b-1] rooms b-1 b 1 f-1 f 1 r-1 r 1 9 {
                rooms[b-1][f-1][r-1] = 8;
            } rooms[b-1][f-1][r-1] = 8 rooms[b-1][f-1][r-1] rooms[b-1][f-1] rooms[b-1] rooms b-1 b 1 f-1 f 1 r-1 r 1 8 int count = 0; count 0 for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       } int[][] bi rooms {
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       } {
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       } for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            } int[] fi bi {
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            } {
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            } for(int ri : fi){
                    System.out.print( " " + ri);
                } int ri fi {
                    System.out.print( " " + ri);
                } {
                    System.out.print( " " + ri);
                } System.out.print( " " + ri) System.out.print System.out System System.out " " + ri " " ri System.out.println() System.out.println System.out System System.out if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            } count != rooms.length-1 count rooms.length-1 rooms.length rooms rooms.length 1 {
                count++;
                System.out.println("####################");
            } count++ count System.out.println("####################") System.out.println System.out System System.out "####################" scanner.close() scanner.close scanner String[] args args public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    }
} public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int[][][] rooms = new int[4][3][10];

        int max = scanner.nextInt();
        int b,f,r,v;
        for(int i = 0; i < max; i++){
            b = scanner.nextInt();
            f = scanner.nextInt();
            r = scanner.nextInt();
            v = scanner.nextInt();

            rooms[b-1][f-1][r-1] += v;
            if(rooms[b-1][f-1][r-1] < 0){
                rooms[b-1][f-1][r-1] = 0;
            }
            if(rooms[b-1][f-1][r-1] > 9){
                rooms[b-1][f-1][r-1] = 8;
            }
        }

        int count = 0;
       for(int[][] bi : rooms){
            for(int[] fi : bi){
                for(int ri : fi){
                    System.out.print( " " + ri);
                }
                System.out.println();
            }
            if(count != rooms.length-1){
                count++;
                System.out.println("####################");
            }

       }
        scanner.close();
    }
}

