#include <iostream>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cstring>
using namespace std;

typedef pair<int,int> P;

int h;
char t[1002][100];
P c[4];

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

void solve(int x,int y,int d,int cidx){
	t[y][x] = ' ';

	int nd = -1;
	int nx,ny;
	for(int i=d;i!=(d+7)%8;i=(i+1)%8){
		nx = x + dx[i];
		ny = y + dy[i];
		if(nx>=0 && nx<100 && ny>=0 && ny<h && t[ny][nx]=='*'){
			nd = i;
			break;
		}
	}

	if(nd == -1) return;

	if(d != nd){
		c[cidx] = P(x,y);
		solve(nx,ny,nd,cidx+1);
	}
	else{
		solve(nx,ny,nd,cidx);
	}
}

int main(void){
	bool firstFlg = true;

	while(cin>>h,h){
		memset(t,' ',sizeof(t));
		if(firstFlg) firstFlg = false;
		else cout<<"----------\n";

		getchar();
		for(int i=0;i<h;i++){
			fgets(t[i],100,stdin);
		}

		map<int,int> ans;

		for(int i=0;i<h;i++){
			int len = strlen(t[i]);
			for(int j=0;j<len;j++){
				if(t[i][j] == '*'){
					c[0] = P(j,i);
					solve(j,i,2,1);

					int area =
						((c[1].first - c[0].first + 1) + (c[2].first - c[3].first + 1)) *
						(c[2].second - c[1].second + 1) / 2;
					ans[area]++;
				}
			}
		}

		for(map<int,int>::iterator i=ans.begin();i!=ans.end();i++){
			cout<<i->first<<" "<<i->second<<endl;
		}
	}

	return 0;
}