import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int room[] = new int[450];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int p1 = 0,p2 = 0,p3 = 0;
        int a,b,c,x = 0;
        
        //データ初期化
        for (int i = 0; i < 450; i++) {
            room[i] = 0;
        }
        
        // データ入力
        for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        }
	  	//出力
        for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        }
        scanner.close();
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int room[] = new int[450];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int p1 = 0,p2 = 0,p3 = 0;
        int a,b,c,x = 0;
        
        //データ初期化
        for (int i = 0; i < 450; i++) {
            room[i] = 0;
        }
        
        // データ入力
        for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        }
	  	//出力
        for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        }
        scanner.close();
  }
} Main public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int room[] = new int[450];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int p1 = 0,p2 = 0,p3 = 0;
        int a,b,c,x = 0;
        
        //データ初期化
        for (int i = 0; i < 450; i++) {
            room[i] = 0;
        }
        
        // データ入力
        for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        }
	  	//出力
        for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        }
        scanner.close();
  } main {
	  	Scanner scanner = new Scanner(System.in);
	  	int room[] = new int[450];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int p1 = 0,p2 = 0,p3 = 0;
        int a,b,c,x = 0;
        
        //データ初期化
        for (int i = 0; i < 450; i++) {
            room[i] = 0;
        }
        
        // データ入力
        for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        }
	  	//出力
        for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        }
        scanner.close();
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int room[] = new int[450]; room new int[450] 450 int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int p1 = 0 p1 0 p2 = 0 p2 0 p3 = 0; p3 0 int a a b b c c x = 0; x 0 for (int i = 0; i < 450; i++) {
            room[i] = 0;
        } int i = 0; int i = 0; i 0 i < 450 i 450 i++ i++ i {
            room[i] = 0;
        } {
            room[i] = 0;
        } room[i] = 0 room[i] room i 0 for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        } {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        } a = scanner.nextInt() a scanner.nextInt() scanner.nextInt scanner b = scanner.nextInt() b scanner.nextInt() scanner.nextInt scanner c = scanner.nextInt() c scanner.nextInt() scanner.nextInt scanner x = a *100 + b * 10 + (c - 1) x a *100 + b * 10 + (c - 1) a *100 + b * 10 + (c - 1) a *100 a 100 b * 10 b 10 (c - 1) c 1 room[x] += scanner.nextInt() room[x] room x scanner.nextInt() scanner.nextInt scanner for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        } int i = 1; int i = 1; i 1 i <= 4 i 4 i++ i++ i {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        } {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        } p1 = i * 100 p1 i * 100 i 100 for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	} int j = 1; int j = 1; j 1 j <= 4 j 4 j ++ j ++ j {
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	} {
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	} p2 = j * 10 + p1 p2 j * 10 + p1 j * 10 j 10 p1 for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				} int k = 0; int k = 0; k 0 k < 10 k 10 k ++ k ++ k {
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				} {
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				} p3 = p2 + k p3 p2 + k p2 k if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	} j == 4 && !(i == 4) j == 4 j 4 !(i == 4) (i == 4) i 4 {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	} if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##"); k == 9 k 9 System.out.println("##") System.out.println System.out System System.out "##" System.out.print("##") System.out.print System.out System System.out "##" if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	} !(j == 4) (j == 4) j 4 {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	} if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]); k == 9 k 9 System.out.println(" "+ room[p3]) System.out.println System.out System System.out " "+ room[p3] " " room[p3] room p3 System.out.print(" "+ room[p3]) System.out.print System.out System System.out " "+ room[p3] " " room[p3] room p3 if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		} i == 4 && j == 3 i == 4 i 4 j == 3 j 3 {
    				//System.out.print("\n");
        			break;
        		} break; scanner.close() scanner.close scanner String args[] args
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
	  	Scanner scanner = new Scanner(System.in);
	  	int room[] = new int[450];  // 配列確保（大きめに）
        int n = scanner.nextInt(); // データ数
        int p1 = 0,p2 = 0,p3 = 0;
        int a,b,c,x = 0;
        
        //データ初期化
        for (int i = 0; i < 450; i++) {
            room[i] = 0;
        }
        
        // データ入力
        for (int i = 0; i < n; i++) {
            a = scanner.nextInt();
            b = scanner.nextInt();
            c = scanner.nextInt();
            x = a *100 + b * 10 + (c - 1);
            room[x] += scanner.nextInt();
        }
	  	//出力
        for (int i = 1; i <= 4; i++) {
        	p1 = i * 100; 
        	for(int j = 1; j <= 4; j ++){
        		p2 = j * 10 + p1;
        		for(int k = 0; k < 10 ; k ++  ){
        			p3 = p2 + k;
		        	if(j == 4 && !(i == 4)) {
		        		if(k == 9)
		        			System.out.println("##");
		        		else
		        			System.out.print("##");
		        	}
		        	if(!(j == 4)) {
		        		if(k == 9)
		        			System.out.println(" "+ room[p3]);
		        		else
		        			System.out.print(" "+ room[p3]);
		        	}
		        	
				}
        		if(i == 4 && j == 3) {
    				//System.out.print("\n");
        			break;
        		}
				//System.out.println("");
        	}
        }
        scanner.close();
  }
}
