#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0
#define all(x) x.begin(), x.end()


const int dx[] = { 0, 1, 1, 1, 0,-1,-1,-1};
const int dy[] = {-1,-1, 0, 1, 1, 1, 0,-1};

int n;
char check[1010][82];
char field[1010][82];
map<int,int> mii;

bool inside(int x, int y){
  return !(x>=80 || y>=n || x<0 || y<0 || field[y][x]==0 );
}

void dfs(int x, int y, int d, vector<pair<int,int> >& v){
  int tx = x + dx[d];
  int ty = y + dy[d];

  if( check[y][x] ) return;
  check[y][x] = 1;

  if( inside(tx,ty) && field[ty][tx]=='*' ){
    dfs(tx,ty,d,v);
  }else{
    v.push_back(make_pair(x,y));
    rep(k,8){
      tx = x + dx[k];
      ty = y + dy[k];
      if( !inside(tx,ty) || field[ty][tx]==' ' || check[ty][tx] )continue;
      dfs(tx,ty,k,v);
    }
  }
}

int main(){
  string in;
  for(int t=0; cin>>n,n; t++){
    cin.ignore();
    memset(field,0,sizeof(field));
    memset(check,0,sizeof(check));
    mii.clear();
    if( t>0 )puts("----------");
    
    rep(i,n){
      getline(cin,in);
      strcpy(field[i], in.c_str());
    }
    rep(i,n){
      for(int j=0; field[i][j]!='\0'; j++){
	if( field[i][j]=='*' && !check[i][j] ){
	  int d = -1;
	  rep(k,8){
	    int tx = j + dx[k];
	    int ty = i + dy[k];
	    if( !inside(tx,ty) || field[ty][tx]==' ' ) continue;
	    d = k;
	    break;
	  }
	  vector<pair<int,int> > v;
	  v.push_back(make_pair(j,i));
	  dfs(j, i, d, v);

#if DEB
	  rep(k,v.size()){
	    printf("(%d,%d)\n",v[k].first, v[k].second);
	  }
#endif
	  
	  int sum = ((v[1].first-v[0].first+1)+(v[2].first-v[3].first+1))*(v[3].second-v[0].second+1)/2;
	  //int sum = ((v[3].first-v[0].first+1)+(v[2].first-v[1].first+1))*(v[1].second-v[0].second+1)/2;
	  mii[sum]++;
	}
      }
    }
    map<int,int>::iterator it;
    for(it=mii.begin(); it!=mii.end(); it++){
      printf("%d %d\n",it->first, it->second);
    }
#if DEB
    rep(i,n){
      rep(j,81){
	printf("%d",check[i][j]);
      }
      puts("");
    }
#endif
  }
  return 0;
}