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

public class Main {

    public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    }

} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util public class Main {

    public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    }

} Main public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    } main {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    } int a = 0; a 0 int b = 0; b 0 int f = 0; f 0 int r = 0; r 0 int v = 0; v 0 int b1[][]; b1 int b2[][]; b2 int b3[][]; b3 int b4[][]; b4 b1 = new int[3][10] b1 new int[3][10] 3 10 b2 = new int[3][10] b2 new int[3][10] 3 10 b3 = new int[3][10] b3 new int[3][10] 3 10 b4 = new int[3][10] b4 new int[3][10] 3 10 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) a = Integer.parseInt(br.readLine()) a Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        } int i = 0; int i = 0; i 0 i < a i a i++ i++ i {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        } {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        } String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " b = Integer.parseInt(line[0]) b Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 f = Integer.parseInt(line[1]) - 1 f Integer.parseInt(line[1]) - 1 Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 1 r = Integer.parseInt(line[2]) - 1 r Integer.parseInt(line[2]) - 1 Integer.parseInt(line[2]) Integer.parseInt Integer line[2] line 2 1 v = Integer.parseInt(line[3]) v Integer.parseInt(line[3]) Integer.parseInt Integer line[3] line 3 if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            } 0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10 0 <= r f < 3 0 <= f 0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10 0 < b 0 b b < 5 b 5 0 <= f 0 f f < 3 f 3 0 <= r 0 r r < 10 r 10 {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            } if (b == 1) {
                    b1[f][r] += v;
                } b == 1 b 1 {
                    b1[f][r] += v;
                } b1[f][r] += v b1[f][r] b1[f] b1 f r v if (b == 2) {
                    b2[f][r] += v;
                } b == 2 b 2 {
                    b2[f][r] += v;
                } b2[f][r] += v b2[f][r] b2[f] b2 f r v if (b == 3) {
                    b3[f][r] += v;
                } b == 3 b 3 {
                    b3[f][r] += v;
                } b3[f][r] += v b3[f][r] b3[f] b3 f r v if (b == 4) {
                    b4[f][r] += v;
                } b == 4 b 4 {
                    b4[f][r] += v;
                } b4[f][r] += v b4[f][r] b4[f] b4 f r v {
                
            } for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        } int i = 1; int i = 1; i 1 i < 5 i 5 i++ i++ i {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        } {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        } if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } i == 1 i 1 {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                } int c = 0; int c = 0; c 0 c < 3 c 3 c++ c++ c {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                } {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                } for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    } int x = 0; int x = 0; x 0 x < 10 x 10 x++ x++ x {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    } {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    } if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        } x != 9 x 9 {
                            System.out.print(" " + b1[c][x]);
                        } System.out.print(" " + b1[c][x]) System.out.print System.out System System.out " " + b1[c][x] " " b1[c][x] b1[c] b1 c x {
                            System.out.println(" " + b1[c][x]);
                        } System.out.println(" " + b1[c][x]) System.out.println System.out System System.out " " + b1[c][x] " " b1[c][x] b1[c] b1 c x System.out.println("####################") System.out.println System.out System System.out "####################" if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } i == 2 i 2 {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                } int c = 0; int c = 0; c 0 c < 3 c 3 c++ c++ c {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                } {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                } for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    } int x = 0; int x = 0; x 0 x < 10 x 10 x++ x++ x {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    } {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    } if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        } x != 9 x 9 {
                            System.out.print(" " + b2[c][x]);
                        } System.out.print(" " + b2[c][x]) System.out.print System.out System System.out " " + b2[c][x] " " b2[c][x] b2[c] b2 c x {
                            System.out.println(" " + b2[c][x]);
                        } System.out.println(" " + b2[c][x]) System.out.println System.out System System.out " " + b2[c][x] " " b2[c][x] b2[c] b2 c x System.out.println("####################") System.out.println System.out System System.out "####################" if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } i == 3 i 3 {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            } for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                } int c = 0; int c = 0; c 0 c < 3 c 3 c++ c++ c {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                } {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                } for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    } int x = 0; int x = 0; x 0 x < 10 x 10 x++ x++ x {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    } {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    } if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        } x != 9 x 9 {
                            System.out.print(" " + b3[c][x]);
                        } System.out.print(" " + b3[c][x]) System.out.print System.out System System.out " " + b3[c][x] " " b3[c][x] b3[c] b3 c x {
                            System.out.println(" " + b3[c][x]);
                        } System.out.println(" " + b3[c][x]) System.out.println System.out System System.out " " + b3[c][x] " " b3[c][x] b3[c] b3 c x System.out.println("####################") System.out.println System.out System System.out "####################" if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            } i == 4 i 4 {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            } for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                } int c = 0; int c = 0; c 0 c < 3 c 3 c++ c++ c {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                } {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                } for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    } int x = 0; int x = 0; x 0 x < 10 x 10 x++ x++ x {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    } {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    } if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        } x != 9 x 9 {
                            System.out.print(" " + b4[c][x]);
                        } System.out.print(" " + b4[c][x]) System.out.print System.out System System.out " " + b4[c][x] " " b4[c][x] b4[c] b4 c x {
                            System.out.println(" " + b4[c][x]);
                        } System.out.println(" " + b4[c][x]) System.out.println System.out System System.out " " + b4[c][x] " " b4[c][x] b4[c] b4 c x String[] args args public class Main {

    public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    }

} public class Main {

    public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    }

} Main
import java.io.*;
import java.util.ArrayList;

public class Main {

    public static void main(String[] args) throws IOException {

        int a = 0;
        int b = 0;
        int f = 0;
        int r = 0;
        int v = 0;
        int b1[][];
        int b2[][];
        int b3[][];
        int b4[][];

        b1 = new int[3][10];
        b2 = new int[3][10];
        b3 = new int[3][10];
        b4 = new int[3][10];

//        for (int i = 0; i < 3; i++) {
//            b1[i] = new int[10];
//            b2[i] = new int[10];
//            b3[i] = new int[10];
//            b4[i] = new int[10];
//        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        a = Integer.parseInt(br.readLine());

        for (int i = 0; i < a; i++) {

            String[] line = br.readLine().split(" ");

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

            if (0 < b && b < 5 && 0 <= f && f < 3 && 0 <= r && r < 10) {

                if (b == 1) {
                    b1[f][r] += v;
                }

                if (b == 2) {
                    b2[f][r] += v;
                }

                if (b == 3) {
                    b3[f][r] += v;
                }

                if (b == 4) {
                    b4[f][r] += v;
                }

            }
            
            else {
                
            }

        }

        for (int i = 1; i < 5; i++) {

            if (i == 1) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b1[c][x]);
                        } else {
                            System.out.println(" " + b1[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 2) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b2[c][x]);
                        } else {
                            System.out.println(" " + b2[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 3) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b3[c][x]);
                        } else {
                            System.out.println(" " + b3[c][x]);
                        }

                    }
                }
                System.out.println("####################");
            }

            if (i == 4) {
                for (int c = 0; c < 3; c++) {

                    for (int x = 0; x < 10; x++) {

                        if (x != 9) {
                            System.out.print(" " + b4[c][x]);
                        } else {
                            System.out.println(" " + b4[c][x]);
                        }

                    }
                }
            }

            

        }

    }

}