

import java.util.Scanner;



public class Main {   
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    }
}

class Tower{
    
    Floor[] floor = new Floor[3];
    
    Tower(){
        for(int i=0; i < floor.length; i++) floor[i] = new Floor();        
    }
    
    void index(int f ,int r ,int v){
        floor[f-1].addPeople(r, v);
    }
    
    String print(){
        String result = "";
        for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        }
        return result;
    }
}

class Floor{    
    int[] room = new int[10];
    
    Floor(){
        for(int i=0; i < room.length; i++) room[i] = 0;
    }
    
    void addPeople(int r ,int v){
        this.room[r-1] += v;
    }
}

        import java.util.Scanner; Scanner java.util public class Main {   
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    } main {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Tower[] tower = new Tower[4]; tower new Tower[4] 4 for(int i=0; i < tower.length; i++) tower[i] = new Tower(); int i=0; int i=0; i 0 i < tower.length i tower.length tower tower.length i++ i++ i tower[i] = new Tower(); tower[i] = new Tower() tower[i] tower i new Tower() int n; n n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        } int i=0; int i=0; i 0 i < n i n i++ i++ i {
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        } {
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        } tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt()) tower[sc.nextInt()-1].index tower[sc.nextInt()-1] tower sc.nextInt()-1 sc.nextInt() sc.nextInt sc 1 sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc sc.nextInt() sc.nextInt sc String result = ""; result "" for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        } int i=0; int i=0; i 0 i < tower.length i tower.length tower tower.length i++ i++ i {
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        } {
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        } result += tower[i].print() result tower[i].print() tower[i].print tower[i] tower i if(i != tower.length -1) result += "####################\n"; i != tower.length -1 i tower.length -1 tower.length tower tower.length 1 result += "####################\n" result "####################\n" System.out.print(result) System.out.print System.out System System.out result String[] args args class Tower{
    
    Floor[] floor = new Floor[3];
    
    Tower(){
        for(int i=0; i < floor.length; i++) floor[i] = new Floor();        
    }
    
    void index(int f ,int r ,int v){
        floor[f-1].addPeople(r, v);
    }
    
    String print(){
        String result = "";
        for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        }
        return result;
    }
} Tower Floor[] floor = new Floor[3]; floor new Floor[3] 3 Tower(){
        for(int i=0; i < floor.length; i++) floor[i] = new Floor();        
    } Tower {
        for(int i=0; i < floor.length; i++) floor[i] = new Floor();        
    } for(int i=0; i < floor.length; i++) floor[i] = new Floor(); int i=0; int i=0; i 0 i < floor.length i floor.length floor floor.length i++ i++ i floor[i] = new Floor(); floor[i] = new Floor() floor[i] floor i new Floor() void index(int f ,int r ,int v){
        floor[f-1].addPeople(r, v);
    } index {
        floor[f-1].addPeople(r, v);
    } floor[f-1].addPeople(r, v) floor[f-1].addPeople floor[f-1] floor f-1 f 1 r v int f f int r r int v v String print(){
        String result = "";
        for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        }
        return result;
    } print {
        String result = "";
        for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        }
        return result;
    } String result = ""; result "" for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        } Floor a floor {
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        } {
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        } for(int b : a.room){
                result += " " + b;
            } int b a.room a a.room {
                result += " " + b;
            } {
                result += " " + b;
            } result += " " + b result " " + b " " b result += "\n" result "\n" return result; result class Floor{    
    int[] room = new int[10];
    
    Floor(){
        for(int i=0; i < room.length; i++) room[i] = 0;
    }
    
    void addPeople(int r ,int v){
        this.room[r-1] += v;
    }
} Floor int[] room = new int[10]; room new int[10] 10 Floor(){
        for(int i=0; i < room.length; i++) room[i] = 0;
    } Floor {
        for(int i=0; i < room.length; i++) room[i] = 0;
    } for(int i=0; i < room.length; i++) room[i] = 0; int i=0; int i=0; i 0 i < room.length i room.length room room.length i++ i++ i room[i] = 0; room[i] = 0 room[i] room i 0 void addPeople(int r ,int v){
        this.room[r-1] += v;
    } addPeople {
        this.room[r-1] += v;
    } this.room[r-1] += v this.room[r-1] this.room this this.room r-1 r 1 v int r r int v v public class Main {   
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    }
} public class Main {   
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    }
} Main


import java.util.Scanner;



public class Main {   
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        Tower[] tower = new Tower[4];
        for(int i=0; i < tower.length; i++) tower[i] = new Tower();
        
        int n;
        n = sc.nextInt();
        
        for(int i=0; i < n; i++){
            //System.out.println(tower[0]);
            tower[sc.nextInt()-1].index(sc.nextInt(), sc.nextInt(), sc.nextInt());
        }
        String result = "";
        for(int i=0; i < tower.length; i++){
            result += tower[i].print();
            if(i != tower.length -1) result += "####################\n";
        }
        //result = result.substring(0, result.length() - 2);
        
        System.out.print(result);
    }
}

class Tower{
    
    Floor[] floor = new Floor[3];
    
    Tower(){
        for(int i=0; i < floor.length; i++) floor[i] = new Floor();        
    }
    
    void index(int f ,int r ,int v){
        floor[f-1].addPeople(r, v);
    }
    
    String print(){
        String result = "";
        for(Floor a : floor){
            for(int b : a.room){
                result += " " + b;
            }
            result += "\n";
        }
        return result;
    }
}

class Floor{    
    int[] room = new int[10];
    
    Floor(){
        for(int i=0; i < room.length; i++) room[i] = 0;
    }
    
    void addPeople(int r ,int v){
        this.room[r-1] += v;
    }
}

       
