import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	}
} import java.io.*; io.* java import java.util.ArrayList; ArrayList java.util public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	}
} Main public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	} main {
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	} BufferedReader input=new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb=new StringBuilder(); sb new StringBuilder() String str=input.readLine(); str input.readLine() input.readLine input int n=Integer.parseInt(str); n Integer.parseInt(str) Integer.parseInt Integer str int b=0; b 0 int f=0; f 0 int r=0; r 0 int v=0; v 0 int bangou=0; bangou 0 int[] manshion=new int[300]; manshion new int[300] 300 for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		} int i=0; int i=0; i 0 i<300 i 300 i++ i++ i {
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		} {
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		} if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			} (i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239) (i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239) (i>=60&&i<=79) i>=60 i 60 i<=79 i 79 (i>=140&&i<=159) i>=140 i 140 i<=159 i 159 (i>=220&&i<=239) i>=220 i 220 i<=239 i 239 {	
				manshion[i]=99;//#
			} manshion[i]=99 manshion[i] manshion i 99 if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			} i%2==0 i%2 i 2 0 {
				manshion[i]=999;//??????
			} manshion[i]=999 manshion[i] manshion i 999 {
				manshion[i]=0;
			} manshion[i]=0 manshion[i] manshion i 0 for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		} {
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		} String str2=input.readLine(); str2 input.readLine() input.readLine input String[] arr =str2.split(" "); arr str2.split(" ") str2.split str2 " " b=Integer.parseInt(arr[0]) b Integer.parseInt(arr[0]) Integer.parseInt Integer arr[0] arr 0 f=Integer.parseInt(arr[1]) f Integer.parseInt(arr[1]) Integer.parseInt Integer arr[1] arr 1 r=Integer.parseInt(arr[2]) r Integer.parseInt(arr[2]) Integer.parseInt Integer arr[2] arr 2 v=Integer.parseInt(arr[3]) v Integer.parseInt(arr[3]) Integer.parseInt Integer arr[3] arr 3 bangou=((b-1)*4+f)*20-(20-r*2) bangou ((b-1)*4+f)*20-(20-r*2) ((b-1)*4+f)*20 ((b-1)*4+f) (b-1)*4 (b-1) b 1 4 f 20 (20-r*2) 20 r*2 r 2 manshion[bangou-1]+=v manshion[bangou-1] manshion bangou-1 bangou 1 v for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		} int i=0; int i=0; i 0 i<manshion.length i manshion.length manshion manshion.length i++ i++ i {
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		} {
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		} if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			} manshion[i]==999 manshion[i] manshion i 999 {
				sb.append(" ");
			} sb.append(" ") sb.append sb " " if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			} manshion[i]==99 manshion[i] manshion i 99 {
				sb.append("#");
			} sb.append("#") sb.append sb "#" {
				sb.append(manshion[i]);
			} sb.append(manshion[i]) sb.append sb manshion[i] manshion i if((i+1)%20==0){
				sb.append("\n");
			} (i+1)%20==0 (i+1)%20 (i+1) i 1 20 0 {
				sb.append("\n");
			} sb.append("\n") sb.append sb "\n" System.out.print(sb) System.out.print System.out System System.out sb String[] args args public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	}
} public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	}
} Main
import java.io.*;
import java.util.ArrayList;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb=new StringBuilder();
		String str=input.readLine();
		int n=Integer.parseInt(str);
		int b=0;
		int f=0;
		int r=0;
		int v=0;
		int bangou=0;
		int[] manshion=new int[300];
		for(int i=0;i<300;i++){
			if((i>=60&&i<=79)||(i>=140&&i<=159)||(i>=220&&i<=239)){	
				manshion[i]=99;//#
			}else if(i%2==0){
				manshion[i]=999;//??????
			}else{
				manshion[i]=0;
			}	
		}
		
		for(int i=0;i<n;i++){
			String str2=input.readLine();
			String[] arr =str2.split(" ");
			 b=Integer.parseInt(arr[0]);
			 f=Integer.parseInt(arr[1]);
			 r=Integer.parseInt(arr[2]);
			 v=Integer.parseInt(arr[3]);
			bangou=((b-1)*4+f)*20-(20-r*2);
			manshion[bangou-1]+=v;

		}
		for(int i=0;i<manshion.length;i++){
			if(manshion[i]==999){
				sb.append(" ");
			}else if(manshion[i]==99){
				sb.append("#");
			}else{
				sb.append(manshion[i]);
			}
			if((i+1)%20==0){
				sb.append("\n");
			}
		}
		
		System.out.print(sb);
	}
}