Problem:
Official House

You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.

For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that −v persons left.

Assume that initially no person lives in the building.

Input

In the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line.

Output

For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings.

Constraints

No incorrect building, floor and room numbers are given.

0 ≤ the number of tenants during the management ≤ 9

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

0 0 8 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 7 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
####################
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0

Solution in JAVA (judge verdict: WA: Presentation Error)



import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		int[][][] house = new int[4][3][10];
		int build = 0;
		int floor = 0;
		int room = 0;
		int count = 0;

		Scanner in = new Scanner(System.in);
		int num = in.nextInt();

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

			build = in.nextInt();
			floor = in.nextInt();
			room = in.nextInt();
			count = in.nextInt();

			if(build == 1) {

				if(floor == 1 ) {

					if(room == 1) {

						house[0][0][0] += count;

					}else if(room == 2) {

						house[0][0][1] += count;

					}else if(room == 3) {

						house[0][0][2] += count;

					}else if(room == 4) {

						house[0][0][3] += count;

					}else if(room == 5) {

						house[0][0][4] += count;

					}else if(room == 6) {

						house[0][0][5] += count;

					}else if(room == 7) {

						house[0][0][6] += count;

					}else if(room == 8) {

						house[0][0][7] += count;

					}else if(room == 9) {

						house[0][0][8] += count;

					}else if(room == 10) {

						house[0][0][9] += count;

					}
				}else if(floor == 2 ) {

					if(room == 1) {

						house[0][1][0] += count;

					}else if(room == 2) {

						house[0][1][1] += count;

					}else if(room == 3) {

						house[0][1][2] += count;

					}else if(room == 4) {

						house[0][1][3] += count;

					}else if(room == 5) {

						house[0][1][4] += count;

					}else if(room == 6) {

						house[0][1][5] += count;

					}else if(room == 7) {

						house[0][1][6] += count;

					}else if(room == 8) {

						house[0][1][7] += count;

					}else if(room == 9) {

						house[0][1][8] += count;

					}else if(room == 10) {

						house[0][1][9] += count;

					}
				}else if(floor == 3 ) {

					if(room == 1) {

						house[0][2][0] += count;

					}else if(room == 2) {

						house[0][2][1] += count;

					}else if(room == 3) {

						house[0][2][2] += count;

					}else if(room == 4) {

						house[0][2][3] += count;

					}else if(room == 5) {

						house[0][2][4] += count;

					}else if(room == 6) {

						house[0][2][5] += count;

					}else if(room == 7) {

						house[0][2][6] += count;

					}else if(room == 8) {

						house[0][2][7] += count;

					}else if(room == 9) {

						house[0][2][8] += count;

					}else if(room == 10) {

						house[0][2][9] += count;

					}
				}
			}else if(build == 2) {

				if(floor == 1 ) {

					if(room == 1) {

						house[1][0][0] += count;

					}else if(room == 2) {

						house[1][0][1] += count;

					}else if(room == 3) {

						house[1][0][2] += count;

					}else if(room == 4) {

						house[1][0][3] += count;

					}else if(room == 5) {

						house[1][0][4] += count;

					}else if(room == 6) {

						house[1][0][5] += count;

					}else if(room == 7) {

						house[1][0][6] += count;

					}else if(room == 8) {

						house[1][0][7] += count;

					}else if(room == 9) {

						house[1][0][8] += count;

					}else if(room == 10) {

						house[1][0][9] += count;

					}
				}else if(floor == 2 ) {

					if(room == 1) {

						house[1][1][0] += count;

					}else if(room == 2) {

						house[1][1][1] += count;

					}else if(room == 3) {

						house[1][1][2] += count;

					}else if(room == 4) {

						house[1][1][3] += count;

					}else if(room == 5) {

						house[1][1][4] += count;

					}else if(room == 6) {

						house[1][1][5] += count;

					}else if(room == 7) {

						house[1][1][6] += count;

					}else if(room == 8) {

						house[1][1][7] += count;

					}else if(room == 9) {

						house[1][1][8] += count;

					}else if(room == 10) {

						house[1][1][9] += count;

					}
				}else if(floor == 3 ) {

					if(room == 1) {

						house[1][2][0] += count;

					}else if(room == 2) {

						house[1][2][1] += count;

					}else if(room == 3) {

						house[1][2][2] += count;

					}else if(room == 4) {

						house[1][2][3] += count;

					}else if(room == 5) {

						house[1][2][4] += count;

					}else if(room == 6) {

						house[1][2][5] += count;

					}else if(room == 7) {

						house[1][2][6] += count;

					}else if(room == 8) {

						house[1][2][7] += count;

					}else if(room == 9) {

						house[1][2][8] += count;

					}else if(room == 10) {

						house[1][2][9] += count;

					}
				}
			}else if(build == 3) {

				if(floor == 1 ) {

					if(room == 1) {

						house[2][0][0] += count;

					}else if(room == 2) {

						house[2][0][1] += count;

					}else if(room == 3) {

						house[2][0][2] += count;

					}else if(room == 4) {

						house[2][0][3] += count;

					}else if(room == 5) {

						house[2][0][4] += count;

					}else if(room == 6) {

						house[2][0][5] += count;

					}else if(room == 7) {

						house[2][0][6] += count;

					}else if(room == 8) {

						house[2][0][7] += count;

					}else if(room == 9) {

						house[2][0][8] += count;

					}else if(room == 10) {

						house[2][0][9] += count;

					}
				}else if(floor == 2 ) {

					if(room == 1) {

						house[2][1][0] += count;

					}else if(room == 2) {

						house[2][1][1] += count;

					}else if(room == 3) {

						house[2][1][2] += count;

					}else if(room == 4) {

						house[2][1][3] += count;

					}else if(room == 5) {

						house[2][1][4] += count;

					}else if(room == 6) {

						house[2][1][5] += count;

					}else if(room == 7) {

						house[2][1][6] += count;

					}else if(room == 8) {

						house[2][1][7] += count;

					}else if(room == 9) {

						house[2][1][8] += count;

					}else if(room == 10) {

						house[2][1][9] += count;

					}
				}else if(floor == 3 ) {

					if(room == 1) {

						house[2][2][0] += count;

					}else if(room == 2) {

						house[2][2][1] += count;

					}else if(room == 3) {

						house[2][2][2] += count;

					}else if(room == 4) {

						house[2][2][3] += count;

					}else if(room == 5) {

						house[2][2][4] += count;

					}else if(room == 6) {

						house[2][2][5] += count;

					}else if(room == 7) {

						house[2][2][6] += count;

					}else if(room == 8) {

						house[2][2][7] += count;

					}else if(room == 9) {

						house[2][2][8] += count;

					}else if(room == 10) {

						house[2][2][9] += count;

					}
				}
			}else if(build == 4) {

				if(floor == 1 ) {

					if(room == 1) {

						house[3][0][0] += count;

					}else if(room == 2) {

						house[3][0][1] += count;

					}else if(room == 3) {

						house[3][0][2] += count;

					}else if(room == 4) {

						house[3][0][3] += count;

					}else if(room == 5) {

						house[3][0][4] += count;

					}else if(room == 6) {

						house[3][0][5] += count;

					}else if(room == 7) {

						house[3][0][6] += count;

					}else if(room == 8) {

						house[3][0][7] += count;

					}else if(room == 9) {

						house[3][0][8] += count;

					}else if(room == 10) {

						house[3][0][9] += count;

					}
				}else if(floor == 2 ) {

					if(room == 1) {

						house[3][1][0] += count;

					}else if(room == 2) {

						house[3][1][1] += count;

					}else if(room == 3) {

						house[3][1][2] += count;

					}else if(room == 4) {

						house[3][1][3] += count;

					}else if(room == 5) {

						house[3][1][4] += count;

					}else if(room == 6) {

						house[3][1][5] += count;

					}else if(room == 7) {

						house[3][1][6] += count;

					}else if(room == 8) {

						house[3][1][7] += count;

					}else if(room == 9) {

						house[3][1][8] += count;

					}else if(room == 10) {

						house[3][1][9] += count;

					}
				}else if(floor == 3 ) {

					if(room == 1) {

						house[3][2][0] += count;

					}else if(room == 2) {

						house[3][2][1] += count;

					}else if(room == 3) {

						house[3][2][2] += count;

					}else if(room == 4) {

						house[3][2][3] += count;

					}else if(room == 5) {

						house[3][2][4] += count;

					}else if(room == 6) {

						house[3][2][5] += count;

					}else if(room == 7) {

						house[3][2][6] += count;

					}else if(room == 8) {

						house[3][2][7] += count;

					}else if(room == 9) {

						house[3][2][8] += count;

					}else if(room == 10) {

						house[3][2][9] += count;

					}
				}
			}
		}

		int b = 0;
		int f = 0;
		int r = 0;

		for(b = 0; b < 4; b++) {

			for(f = 0; f < 3; f++) {

				for(r = 0; r < 9; r++) {

					System.out.print(" " + house[b][f][r]);

				}

				System.out.println(" " + house[b][f][r]);

			}

			if(b < 3) {

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

					System.out.print("#");

				}

			}

			System.out.println("");

		}
	}
}