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 C# (judge verdict: Accepted)

using System;

namespace ITP1_6_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            int[] bld11 = new int[10];
            int[] bld12 = new int[10];
            int[] bld13 = new int[10];
            int[] bld21 = new int[10];
            int[] bld22 = new int[10];
            int[] bld23 = new int[10];
            int[] bld31 = new int[10];
            int[] bld32 = new int[10];
            int[] bld33 = new int[10];
            int[] bld41 = new int[10];
            int[] bld42 = new int[10];
            int[] bld43 = new int[10];

            for (int j = 0; j < num; j++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int b = int.Parse(input[0]);
                int f = int.Parse(input[1]);
                int r = int.Parse(input[2]);
                int v = int.Parse(input[3]);

                switch (b)
                {
                    case 1:
                        switch (f)
                        {
                            case 1:
                                bld11[r - 1] += v;
                                break;
                            case 2:
                                bld12[r - 1] += v;
                                break;
                            case 3:
                                bld13[r - 1] += v;
                                break;
                        }
                        break;
                    case 2:
                        switch (f)
                        {
                            case 1:
                                bld21[r - 1] += v;
                                break;
                            case 2:
                                bld22[r - 1] += v;
                                break;
                            case 3:
                                bld23[r - 1] += v;
                                break;
                        }
                        break;
                    case 3:
                        switch (f)
                        {
                            case 1:
                                bld31[r - 1] += v;
                                break;
                            case 2:
                                bld32[r - 1] += v;
                                break;
                            case 3:
                                bld33[r - 1] += v;
                                break;
                        }
                        break;
                    case 4:
                        switch (f)
                        {
                            case 1:
                                bld41[r - 1] += v;
                                break;
                            case 2:
                                bld42[r - 1] += v;
                                break;
                            case 3:
                                bld43[r - 1] += v;
                                break;
                        }
                        break;
                }

            }
                for (int n1=0; n1<10; n1++)
                {
                    Console.Write(" {0}", bld11[n1]);
                }
                Console.WriteLine();

                for (int n2 = 0; n2 < 10; n2++)
                {
                    Console.Write(" {0}", bld12[n2]);
                }
                Console.WriteLine();

                for (int n3 = 0; n3 < 10; n3++)
                {
                    Console.Write(" {0}", bld13[n3]);
                }
                Console.WriteLine();
                Console.WriteLine("####################");

                for (int n5 = 0; n5 < 10; n5++)
                {
                    Console.Write(" {0}", bld21[n5]);
                }
                Console.WriteLine();

                for (int n6 = 0; n6 < 10; n6++)
                {
                    Console.Write(" {0}", bld22[n6]);
                }
                Console.WriteLine();

                for (int n7 = 0; n7 < 10; n7++)
                {
                    Console.Write(" {0}", bld23[n7]);
                }
                Console.WriteLine();
                Console.WriteLine("####################");

                for (int n8 = 0; n8 < 10; n8++)
                {
                    Console.Write(" {0}", bld31[n8]);
                }
                Console.WriteLine();

                for (int n9 = 0; n9 < 10; n9++)
                {
                    Console.Write(" {0}", bld32[n9]);
                }
                Console.WriteLine();

                for (int n10 = 0; n10 < 10; n10++)
                {
                    Console.Write(" {0}", bld33[n10]);
                }
                Console.WriteLine();
                Console.WriteLine("####################");

                for (int n11 = 0; n11 < 10; n11++)
                {
                    Console.Write(" {0}", bld41[n11]);
                }
                Console.WriteLine();

                for (int n12 = 0; n12 < 10; n12++)
                {
                    Console.Write(" {0}", bld42[n12]);
                }
                Console.WriteLine();

                for (int n13 = 0; n13 < 10; n13++)
                {
                    Console.Write(" {0}", bld43[n13]);
                }
                Console.WriteLine();

            

        }
    }
}