#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int dx[]={-1,0,1,1,1,0,-1,-1},dy[]={-1,-1,-1,0,1,1,1,0};
int h;
char in[1000][82];
int Y[5],X[5],n;
map<int,int> M;

void dfs(int y,int x,int pd)
{
	in[y][x]=' ';
	int ny=y+dy[pd],nx=x+dx[pd];
	if(ny<0||nx<0||ny>=h||!in[ny][nx]||in[ny][nx]!='*')
	{
		Y[n]=y; X[n]=x; n++;
		rep(d,7)
		{
			pd=pd+1&7;
			ny=y+dy[pd],nx=x+dx[pd];
			if(ny<0||nx<0||ny>=h||!in[ny][nx])continue;
			if(in[ny][nx]=='*')goto FOUND;
		}
		return; FOUND:;
	}
	dfs(ny,nx,pd);
}
int main()
{
	bool f=1;
	while(scanf("%d",&h),h)
	{
		if(!f)puts("----------"); else f=0;
		
		M.clear(); getchar();
		rep(i,h)fgets(in[i],81,stdin),in[i][strlen(in[i])-1]=0;
		
		rep(i,h)for(int j=0;in[i][j];j++)if(in[i][j]=='*')
		{
			n=1; Y[0]=i; X[0]=j;
			dfs(i,j,3);
			M[(Y[3]-Y[0]+1)*(X[1]-X[0]+X[2]-X[3]+2)/2]++;
		}
		fr(i,M)printf("%d %d\n",i->first,i->second);
	}
	return 0;
}