#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
string s[999];
int n;
int dx[]={1,0,-1},dy[]={1,1,1};
int ful(int y,int x){
    int sum=0;
    while(1){
        x++;
        if(s[y].size()<=x){
            x--;
            break;
        }
        if(s[y][x]==' '){
            x--;
             break;
        }
    }
    s[y][x]='#';sum++;
        if(y+1<n){
          if(x+1<s[y+1].size()&&x-1>=0){
           if(s[y+1][x+1]=='*'&&s[y+1][x-1]=='*'){
              sum+=ful(y+1,x+1);
            }
            else goto L;
         }
          else{L:;int ppp=0;
          r(i,3){
          int yy=y+dy[i];
          int xx=x+dx[i];
           if(yy>=0&&yy<n&&xx>=0)
             if(xx<s[yy].size())
                 if(s[yy][xx]=='*')
                    if(!ppp)
                     sum+=ful(yy,xx),ppp++;}}
           }

    //cout<<y<<x<<endl;r(k,n)cout<<s[k]<<endl;
    return sum;
}
int con(int y,int x){
    int sum=0,p=x,pp=x;
    for(;x<s[y].size();){
        if(s[y][x]=='#'){
            break;
        }
        if(p==pp)s[y][x]='#';
        if(x-1>=0)if(s[y][x-1]=='#'&&s[y][x]=='*')s[y][x]='#';
        sum++;
        x++;p++;
    }
    r(i,3){
        int yy=y+dy[i];
        int xx=pp+dx[i];
        if(yy>=0&&yy<n&&xx>=0)
            if(xx<s[yy].size())
                if(s[yy][xx]=='*')
                    sum+=con(yy,xx);
    }
    return sum;
}
void del(){
    r(i,n)r(j,s[i].size())
      if(s[i][j]=='#')s[i][j]=' ';
}
int main(){

    int ppp=0;

    while(cin>>n,n){

        if(ppp)cout<<"----------"<<endl;

        ppp++;

        string t;

        getline(cin,t);

        r(i,n){

            getline(cin,t);

            s[i]=t;

            //cout<<t<<endl;
        }

        map<int,int>m;

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

            for(int j=0;j<s[i].size();j++){

                int sum=0;

                if(s[i][j]=='*'){

                    sum+=ful(i,j);//r(k,n)cout<<s[k]<<endl;

                    sum+=con(i,j);

                    del();

                    m[sum]++;//cout<<sum<<endl;
                }
                
            }

        }

        for(map<int,int>::iterator it=m.begin();it!=m.end();it++)
            cout<<(*it).first<<' '<<(*it).second<<endl;
        
    }
}