import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

public class Main {
    public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    }
    private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    }
}
class Dom {
    final int b; //?£?
    final int f; //???
    final int r; //??????
    int v; //???
    static List<Dom> allRes = new ArrayList<Dom>();
    
    Dom (int b, int f, int r, int v){
        this.b = b;
        this.f = f;
        this.r = r;
        this.v = v;
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util public class Main {
    public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    }
    private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    }
} Main public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    } main {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    } for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        } int b=1; int b=1; b 1 b<=4 b 4 b++ b++ b {
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        } {
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        } for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            } int f=1; int f=1; f 1 f<=3 f 3 f++ f++ f {
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            } {
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            } for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                } int r=1; int r=1; r 1 r<=10 r 10 r++ r++ r {
                    Dom.allRes.add(new Dom(b, f, r, 0));
                } {
                    Dom.allRes.add(new Dom(b, f, r, 0));
                } Dom.allRes.add(new Dom(b, f, r, 0)) Dom.allRes.add Dom.allRes Dom Dom.allRes new Dom(b, f, r, 0) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String hashs =  HashMarks(20).toString(); hashs HashMarks(20).toString() HashMarks(20).toString HashMarks(20) HashMarks 20 for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        } {
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        } String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int bb = Integer.parseInt(line[0]); bb Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int ff = Integer.parseInt(line[1]); ff Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int rr = Integer.parseInt(line[2]); rr Integer.parseInt(line[2]) Integer.parseInt Integer line[2] line 2 int vv = Integer.parseInt(line[3]); vv Integer.parseInt(line[3]) Integer.parseInt Integer line[3] line 3 for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            } Dom dom Dom.allRes Dom Dom.allRes {
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            } {
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            } if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                } dom.b != bb || dom.f != ff || dom.r != rr dom.b != bb || dom.f != ff || dom.r != rr dom.b != bb dom.b dom dom.b bb dom.f != ff dom.f dom dom.f ff dom.r != rr dom.r dom dom.r rr {
                    continue;
                } continue; {
                    dom.v += vv;
                } dom.v += vv dom.v dom dom.v vv int cnt = 0; cnt 0 for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        } Iterator<Dom> d = Dom.allRes.iterator(); Iterator<Dom> d = Dom.allRes.iterator(); d Dom.allRes.iterator() Dom.allRes.iterator Dom.allRes Dom Dom.allRes d.hasNext() d.hasNext d {
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        } {
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        } Dom dom = d.next(); dom d.next() d.next d cnt += 1 cnt 1 System.out.print(" " + dom.v) System.out.print System.out System System.out " " + dom.v " " dom.v dom dom.v if (cnt%10==0){
                System.out.println();
            } cnt%10==0 cnt%10 cnt 10 0 {
                System.out.println();
            } System.out.println() System.out.println System.out System System.out if (!d.hasNext()){
                break;
            } !d.hasNext() d.hasNext() d.hasNext d {
                break;
            } break; if (cnt%30==0){
                System.out.println(hashs);
            } cnt%30==0 cnt%30 cnt 30 0 {
                System.out.println(hashs);
            } System.out.println(hashs) System.out.println System.out System System.out hashs String[] args args private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    } HashMarks {
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i=0; i<n; i++){
            sb.append("#");
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            sb.append("#");
        } {
            sb.append("#");
        } sb.append("#") sb.append sb "#" return sb; sb int n n class Dom {
    final int b; //?£?
    final int f; //???
    final int r; //??????
    int v; //???
    static List<Dom> allRes = new ArrayList<Dom>();
    
    Dom (int b, int f, int r, int v){
        this.b = b;
        this.f = f;
        this.r = r;
        this.v = v;
    }
} Dom final int b; //?£? b final int f; //??? f final int r; //?????? r int v; //??? v static List<Dom> allRes = new ArrayList<Dom>(); allRes new ArrayList<Dom>() Dom (int b, int f, int r, int v){
        this.b = b;
        this.f = f;
        this.r = r;
        this.v = v;
    } Dom {
        this.b = b;
        this.f = f;
        this.r = r;
        this.v = v;
    } this.b = b this.b this this.b b this.f = f this.f this this.f f this.r = r this.r this this.r r this.v = v this.v this this.v v int b b int f f int r r int v v public class Main {
    public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    }
    private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    }
    private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    }
} Main
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

public class Main {
    public static void main(String[] args) throws IOException {
        for (int b=1; b<=4; b++){
            for (int f=1; f<=3; f++){
                for (int r=1; r<=10; r++){
                    Dom.allRes.add(new Dom(b, f, r, 0));
                }
            }
        }
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int n = Integer.parseInt(br.readLine());
        String hashs =  HashMarks(20).toString();
        for (int i=0; i<n; i++){
            String[] line = br.readLine().split(" ");
            int bb = Integer.parseInt(line[0]);
            int ff = Integer.parseInt(line[1]);
            int rr = Integer.parseInt(line[2]);
            int vv = Integer.parseInt(line[3]);
            
            for (Dom dom: Dom.allRes){
                if (dom.b != bb || dom.f != ff || dom.r != rr){
                    continue;
                }else{
                    dom.v += vv;
                }
            }
        }
        int cnt = 0;
        for (Iterator<Dom> d = Dom.allRes.iterator(); d.hasNext();){
            Dom dom = d.next();
            cnt += 1;
            System.out.print(" " + dom.v);
            if (cnt%10==0){
                System.out.println();
            }
            if (!d.hasNext()){
                break;
            }
            if (cnt%30==0){
                System.out.println(hashs);
            }
        }
    }
    private static StringBuilder HashMarks(int n){
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<n; i++){
            sb.append("#");
        }
        return sb;
    }
}
class Dom {
    final int b; //?£?
    final int f; //???
    final int r; //??????
    int v; //???
    static List<Dom> allRes = new ArrayList<Dom>();
    
    Dom (int b, int f, int r, int v){
        this.b = b;
        this.f = f;
        this.r = r;
        this.v = v;
    }
}