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;
using System.Collections.Generic;
using System.Linq;
namespace ITP1_6_C
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }
            return list_temp;
        }
        public static void RoomCheck (int b,int f,int r,int v,ref Dictionary<int,Dictionary<int,Dictionary<int,int>>>  dict){

//            Console.WriteLine("b={0} f={1} r={2} v={3}",b,f,r,v);

            dict[b][f][r] += v;
     

        }

        public static void RoomDisplay (Dictionary<int,Dictionary<int,Dictionary<int,int>>> dict)
        {
            string str = new string ('#',20);
        

            for (int i = 1; i <= 4; i++)
            {
                for (int j = 1; j <= 3; j++)
                {
                    for (int k = 1; k <= 10; k++)
                    {
                        Console.Write(" {0}",dict[i][j][k]);
                    }
                    Console.WriteLine();
                }

                if (i != 4)
                {
                    Console.WriteLine(str);
                }
            }


        }

        public static Dictionary<int,Dictionary<int,Dictionary<int,int>>> RoomInitialize (){

            Dictionary<int,Dictionary<int,Dictionary<int,int>>> mydict = new Dictionary<int,Dictionary<int,Dictionary<int,int>>>{};

            //?£???°????????????
            for (int i = 1; i <= 4; i++)
            {

                Dictionary<int,Dictionary<int,int>> mydict_temp1 = new Dictionary<int,Dictionary<int,int>>{ };
   
                //?????°????????????
                for (int j = 1; j <= 3; j++)
                {

                    Dictionary<int,int> mydict_temp2 = new Dictionary<int,int>{ };

                    //??¨?±???°????????????
                    for (int k = 1; k <= 10; k++)
                    {
                        mydict_temp2.Add(k, 0);
                    }

                    mydict_temp1.Add(j, mydict_temp2);

                }

                mydict.Add(i, mydict_temp1);

            }

            return mydict;

        }

        public static void Main (string[] args)
        {
            List<string[]> list_result = new List<string[]>{};

            list_result = getinputdata ();

            Dictionary<int,Dictionary<int,Dictionary<int,int>>> dictroom = new Dictionary<int,Dictionary<int,Dictionary<int,int>>>{};
            dictroom = RoomInitialize();

            int n= int.Parse(list_result[0][0]);


            for (int i = 1; i <= n; i++)
            {
                RoomCheck(int.Parse(list_result[i][0]),int.Parse(list_result[i][1]),int.Parse(list_result[i][2]),int.Parse(list_result[i][3]),ref dictroom);
            }

            RoomDisplay(dictroom);

         }
    }
}