#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>

using namespace std;

struct P{
  int h,w;
  bool operator < (const P& p) const{
    if(h != p.h) return h < p.h;
    return w < p.w;
  }
};

const int INF = (1<<25);
const int HEIGHT = 1050;
const int WIDTH = 100;
int dh[] = {1,1,1,0,0,-1,-1,-1};
int dw[] = {1,0,-1,1,-1,1,0,-1};

bool come[HEIGHT][WIDTH];
vector<string> field;

bool isInside(int h, int w){
  if(h < 0 || h >= (int)field.size()) return false;
  if(w < 0 || w >= (int)field[h].size()) return false;
  return true;
}

vector<P> rec(int h, int w){
  if(come[h][w]) return vector<P>();
  come[h][w] = true;

  vector<P> res;
  res.push_back((P){h,w});

  for(int i = 0; i < 8; i++){
    int nh = h+dh[i];
    int nw = w+dw[i];
    if(isInside(nh,nw) && field[nh][nw] == '*'){
      vector<P> tmp = rec(nh,nw);
      for(int j = 0; j < (int)tmp.size(); j++) res.push_back(tmp[j]);
    }
  }
  return res;
}

int main(){

  int n;
  bool isFirst = true;
  while(cin >> n && n){
    if(!isFirst) cout << "----------" << endl;
    else isFirst = false;

    memset(come,false,sizeof(come));

    cin.ignore();
    field.resize(n);
    for(int i = 0; i < n; i++) getline(cin,field[i]);

    vector<vector<P> > vec;
    for(int i = 0; i < (int)field.size(); i++)
      for(int j = 0; j < (int)field[i].size(); j++){
	if(come[i][j]) continue;
	if(field[i][j] == ' ') continue;
	vec.push_back(rec(i,j));
      }

    vector<int> ans;
    for(int i = 0; i < (int)vec.size(); i++){
      sort(vec[i].begin(),vec[i].end());
      vector<P>::iterator ite = vec[i].begin();

      int sum = 0;

      while(ite < vec[i].end()){
	vector<P>::iterator nex = lower_bound(vec[i].begin(),vec[i].end(),(P){ite->h+1,0});
	vector<P>::iterator left = nex-1;
	//	cout << ite->h << " " << ite->w << " || " << left->h << " " << left->w << endl;
	sum += (left->w)-(ite->w)+1;
	ite = nex;
      }
      ans.push_back(sum);
    }
    
    sort(ans.begin(),ans.end());
    vector<int>::iterator ite = ans.begin();
    while(ite < ans.end()){
      vector<int>::iterator nex = upper_bound(ans.begin(),ans.end(),*ite);
      cout << *ite << " " << nex-ite << endl;
      ite = nex;
    }
  }
  return 0;
}