#include <stdio.h>
#include<math.h>
int main()
{
   int b,f,r,p[120],ps[120];
   int i,j,n;
   for(i=1;i<=120;i++) ps[i]=0;


   scanf("%d",&n);
   while(n--)
   {


   scanf("%d",&b);

   if (b==1)
   {
       scanf("%d",&f);
       {
           if(f==1)
           {
               scanf("%d",&r);
                   for(i=1;i<=10;i++)
                   {if(i==r) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==2)
           {
               scanf("%d",&r);
                   for(i=11;i<=20;i++)
                   {if(i==r+10) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==3)
           {
               scanf("%d",&r);
                   for(i=21;i<=30;i++)
                   {if(i==r+20) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }

       }//scan floor end

   }//Building end


  else    if (b==2)
   {
       scanf("%d",&f);
       {
           if(f==1)
           {
               scanf("%d",&r);
                   for(i=31;i<=40;i++)
                   {if(i==r+30) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==2)
           {
               scanf("%d",&r);
                   for(i=41;i<=50;i++)
                   {if(i==r+40) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==3)
           {
               scanf("%d",&r);
                   for(i=51;i<=60;i++)
                   {if(i==r+50) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }

       }//scan floor end

   }//Building end

     else if (b==3)
   {
       scanf("%d",&f);
       {
           if(f==1)
           {
               scanf("%d",&r);
                   for(i=61;i<=70;i++)
                   {if(i==r+60) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==2)
           {
               scanf("%d",&r);
                   for(i=71;i<=80;i++)
                   {if(i==r+70) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==3)
           {
               scanf("%d",&r);
                   for(i=81;i<=90;i++)
                   {if(i==r+80) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }

       }//scan floor end

   }//Building end


      else if (b==4)
   {
       scanf("%d",&f);
       {
           if(f==1)
           {
               scanf("%d",&r);
                   for(i=91;i<=100;i++)
                   {if(i==r+90) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==2)
           {
               scanf("%d",&r);
                   for(i=101;i<=110;i++)
                   {if(i==r+100) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }
           else if(f==3)
           {
               scanf("%d",&r);
                   for(i=111;i<=120;i++)
                   {if(i==r+110) {scanf("%d",&p[i]); ps[i]=ps[i]+p[i];}}
           }

       }//scan floor end

   }//Building end

}


//PRINTING PART

    for(i=1;i<=10;i++) {printf(" %d",ps[i]);}printf("\n");
    for(i=11;i<=20;i++) printf(" %d",ps[i]); printf("\n");
    for(i=21;i<=30;i++) printf(" %d",ps[i]);printf("\n");

    printf("####################\n");

    for(i=31;i<=40;i++) printf(" %d",ps[i]);printf("\n");
    for(i=41;i<=50;i++)printf(" %d",ps[i]);printf("\n");
    for(i=51;i<=60;i++) printf(" %d",ps[i]);printf("\n");

    printf("####################\n");

    for(i=61;i<=70;i++) printf(" %d",ps[i]);printf("\n");
    for(i=71;i<=80;i++) printf(" %d",ps[i]);printf("\n");
    for(i=81;i<=90;i++) printf(" %d",ps[i]);printf("\n");

   printf("####################\n");

   for(i=91;i<=100;i++) printf(" %d",ps[i]);printf("\n");
   for(i=101;i<=110;i++) printf(" %d",ps[i]);printf("\n");
   for(i=111;i<=120;i++) printf(" %d",ps[i]);printf("\n");


}



Measured memory_bytes: 2752