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

class Main{
    public static void main(String args[])throws IOException{
        final int tou = 4, kai = 3, number = 10;
        int[][][] x = new int[tou][kai][number];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String n = br.readLine();
        String s;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        }
        for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String args[])throws IOException{
        final int tou = 4, kai = 3, number = 10;
        int[][][] x = new int[tou][kai][number];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String n = br.readLine();
        String s;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        }
        for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        }
    }
} Main public static void main(String args[])throws IOException{
        final int tou = 4, kai = 3, number = 10;
        int[][][] x = new int[tou][kai][number];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String n = br.readLine();
        String s;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        }
        for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        }
    } main {
        final int tou = 4, kai = 3, number = 10;
        int[][][] x = new int[tou][kai][number];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String n = br.readLine();
        String s;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        }
        for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        }
    } final int tou = 4 tou 4 kai = 3 kai 3 number = 10; number 10 int[][][] x = new int[tou][kai][number]; x new int[tou][kai][number] tou kai number BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String n = br.readLine(); n br.readLine() br.readLine br String s; s while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        } (s=br.readLine())!=null (s=br.readLine()) s br.readLine() br.readLine br null {
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        } String[] str = s.split(" "); str s.split(" ") s.split s " " int a = Integer.parseInt(str[0]); a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int b = Integer.parseInt(str[1]); b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int c = Integer.parseInt(str[2]); c Integer.parseInt(str[2]) Integer.parseInt Integer str[2] str 2 int d = Integer.parseInt(str[3]); d Integer.parseInt(str[3]) Integer.parseInt Integer str[3] str 3 if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break; !(a>tou || b>kai || c>number || d>9) (a>tou || b>kai || c>number || d>9) c>number a>tou || b>kai || c>number || d>9 a>tou a tou b>kai b kai c>number c number d>9 d 9 {
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            } switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                } a case 1: 1 case 1: x[a-1][b-1][c-1] += d x[a-1][b-1][c-1] x[a-1][b-1] x[a-1] x a-1 a 1 b-1 b 1 c-1 c 1 d break; case 2: 2 case 2: x[a-1][b-1][c-1] += d x[a-1][b-1][c-1] x[a-1][b-1] x[a-1] x a-1 a 1 b-1 b 1 c-1 c 1 d break; case 3: 3 case 3: x[a-1][b-1][c-1] += d x[a-1][b-1][c-1] x[a-1][b-1] x[a-1] x a-1 a 1 b-1 b 1 c-1 c 1 d break; case 4: 4 case 4: x[a-1][b-1][c-1] += d x[a-1][b-1][c-1] x[a-1][b-1] x[a-1] x a-1 a 1 b-1 b 1 c-1 c 1 d break; break; for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        } int i=0; int i=0; i 0 i<x.length i x.length x x.length i++ i++ i {
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        } {
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        } for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            } int j=0; int j=0; j 0 j<x[i].length j x[i].length x[i] x i x[i].length j++ j++ j {
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            } {
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            } for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                } int k=0; int k=0; k 0 k<x[i][j].length k x[i][j].length x[i][j] x[i] x i j x[i][j].length k++ k++ k {
                    System.out.print(" "+x[i][j][k]);
                } {
                    System.out.print(" "+x[i][j][k]);
                } System.out.print(" "+x[i][j][k]) System.out.print System.out System System.out " "+x[i][j][k] " " x[i][j][k] x[i][j] x[i] x i j k System.out.println("") System.out.println System.out System System.out "" if(i<tou-1){
                System.out.println("####################");
            } i<tou-1 i tou-1 tou 1 {
                System.out.println("####################");
            } System.out.println("####################") System.out.println System.out System System.out "####################" String args[] args
import java.io.*;
import java.util.*;

class Main{
    public static void main(String args[])throws IOException{
        final int tou = 4, kai = 3, number = 10;
        int[][][] x = new int[tou][kai][number];
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String n = br.readLine();
        String s;
        while((s=br.readLine())!=null){
            String[] str = s.split(" ");
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            int c = Integer.parseInt(str[2]);
            int d = Integer.parseInt(str[3]);
            if(!(a>tou || b>kai || c>number || d>9)){
                switch(a){
                    case 1: x[a-1][b-1][c-1] += d; break;
                    case 2: x[a-1][b-1][c-1] += d; break;
                    case 3: x[a-1][b-1][c-1] += d; break;
                    case 4: x[a-1][b-1][c-1] += d; break;
                }
            }
            else break;
        }
        for(int i=0; i<x.length; i++){
            for(int j=0; j<x[i].length; j++){
                for(int k=0; k<x[i][j].length; k++){
                    System.out.print(" "+x[i][j][k]);
                }
                System.out.println("");
            }
            if(i<tou-1){
                System.out.println("####################");
            }
        }
    }
}