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();

            

        }
    }
}

Measured memory_bytes: 9236