import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	} main {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = sc.nextInt(); count sc.nextInt() sc.nextInt sc int[][] house = new int[4][30]; house new int[4][30] 4 30 for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		} int i = 0; int i = 0; i 0 i < house.length i house.length house house.length i ++ i ++ i {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		} {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		} for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			} int j = 0; int j = 0; j 0 j < house[i].length j house[i].length house[i] house i house[i].length j++ j++ j {
				house[i][j] = 0;
			} {
				house[i][j] = 0;
			} house[i][j] = 0 house[i][j] house[i] house i j 0 for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		} int i = 0; int i = 0; i 0 i < count i count i++ i++ i {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		} {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		} int houseNum = sc.nextInt(); houseNum sc.nextInt() sc.nextInt sc int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1); roomNum (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1) (Integer.parseInt(sc.next()) - 1) * 10 (Integer.parseInt(sc.next()) - 1) Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc 1 10 (Integer.parseInt(sc.next()) - 1) Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc 1 int member = sc.nextInt(); member sc.nextInt() sc.nextInt sc house[houseNum - 1][roomNum] += member house[houseNum - 1][roomNum] house[houseNum - 1] house houseNum - 1 houseNum 1 roomNum member for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		} int i = 0; int i = 0; i 0 i < house.length i house.length house house.length i++ i++ i {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		} {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		} for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			} int j = 0; int j = 0; j 0 j < house[i].length j house[i].length house[i] house i house[i].length j++ j++ j {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			} {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			} if(j != 0 && j % 10 == 0) {
					System.out.println();
				} j != 0 && j % 10 == 0 j != 0 j 0 j % 10 == 0 j % 10 j 10 0 {
					System.out.println();
				} System.out.println() System.out.println System.out System System.out System.out.print(" " +  house[i][j]) System.out.print System.out System System.out " " +  house[i][j] " " house[i][j] house[i] house i j System.out.println() System.out.println System.out System System.out if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			} i != 3 i 3 {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			} for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				} int j = 0; int j = 0; j 0 j < 20 j 20 j++ j++ j {
					System.out.print("#");
				} {
					System.out.print("#");
				} System.out.print("#") System.out.print System.out System System.out "#" System.out.println() System.out.println System.out System System.out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
		int[][] house = new int[4][30];

		for(int i = 0;i < house.length; i ++) {
			for(int j = 0;j < house[i].length; j++){
				house[i][j] = 0;
			}

		}

		for(int i = 0;i < count;i++) {
			int houseNum = sc.nextInt();
			int roomNum = (Integer.parseInt(sc.next()) - 1) * 10 + (Integer.parseInt(sc.next()) - 1);
			int member = sc.nextInt();
			house[houseNum - 1][roomNum] += member;

		}

		for(int i = 0;i < house.length;i++) {
			for(int j = 0;j < house[i].length;j++) {
				if(j != 0 && j % 10 == 0) {
					System.out.println();
				}
				System.out.print(" " +  house[i][j]);

			}
			System.out.println();
			if(i != 3) {
				for(int j = 0;j < 20 ;j++) {
					System.out.print("#");
				}
				System.out.println();
			}
		}

	}
}