Problem: If you are a computer user, you should have seen pictures drawn with ASCII characters. Such a picture may not look as good as GIF or Postscript pictures, but is much easier to handle. ASCII pictures can easily be drawn using text editors, and can convey graphical information using only text-based media. Program s extracting information from such pictures may be useful.

We are interested in simple pictures of trapezoids, consisting only of asterisk('*') characters and blank spaces. A trapezoid (trapezium in the Queen's English) is a four-side polygon where at least one pair of its sides is parallel. Furthermore, the picture in this problem satisfies the following conditions.

1. All the asterisks in the picture belong to sides of some trapezoid.
2. Two sides of a trapezoid are horizontal and the other two are vertical or incline 45 degrees.
3. Every side is more than 2 characters long.
4. Two distinct trapezoids do not share any asterisk characters.
5. Sides of two trapezoids do not touch. That is, asterisks of one trapezoid do not appear in eight neighbors of asterisks of a different trapezoid. For example, the following arrangements never appear.




****    |    ****         |   ******
*  *    |    *   * ***    |   *   *
****    |    ******* *    |   ****
****       |          ***    |       ****
*  *       |                 |       *  *
****       |                 |       ****


Some trapezoids may appear inside others. For example, the following is a valid picture.


*********
*       *
* ***   *
* *  *  *
* ***** *
*       *
*********


Your task is to recognize trapezoids in the picture and to calculate the area of each trapezoid. The area of a trapezoid is the number of characters on or inside its four sides, including the areas of the trapezoids inside it, if any.



Input

The input contains several descriptions of pictures. Each of then starts with a line containing an integer h (1 ≤ h ≤ 1000), where h is the height (number of lines) of the picture. Each line of the picture consists only of asterisk and space characters, and contains less than 80 characters. The lines of the picture do not necessarily have the same length and may contain redundant space characters at the end. After the last picture, and integer zero terminates the input.

Output

For each picture, your program should produce output lines each containing two integers m and n is this order, which means there are n trapezoids of area m in the picture. output lines for one picture should be in ascending order on m and count all the trapezoids in the picture.

Output lines for two pictures should be separated by a line containing ten hyphen ('-') characters. This separator line should not appear before the output for the first picture nor after the output for the last.

Examples

Input

7
********
*      *
* ***  *
* * *  *
* ***  *
*      *
********
9

***
*  *
*****     *****
          *   *
    ***   *****
   * *
  * *
 ***
11
    ****                                      *******************
   *   *  *********                          *                  *
  ******  *       *    ****                 *  *********        *
          * ***   *   *  *                 *  *         *       *
***       * *  *  *  ****  *******        *  *  *** ***  *      *
* *       * ***** *         *   *        *  *   * *  * *  *     *
***       *       *          ***        *  *    ***   ***  *    *
          *********                    *  *                 *   *
                                      *  *********************  *
                                     *                          *
                                    *****************************
0


Output

9 1
56 1
----------
12 2
15 1
----------
9 3
12 2
15 2
63 1
105 1
264 1


Input

7
********
*      *
* ***  *
* * *  *
* ***  *
*      *
********
9

***
*  *
*****     *****
*   *
***   *****
* *
* *
***
11
****                                      *******************
*   *  *********                          *                  *
******  *       *    ****                 *  *********        *
* ***   *   *  *                 *  *         *       *
***       * *  *  *  ****  *******        *  *  *** ***  *      *
* *       * ***** *         *   *        *  *   * *  * *  *     *
***       *       *          ***        *  *    ***   ***  *    *
*********                    *  *                 *   *
*  *********************  *
*                          *
*****************************
0


Output

9 1
56 1
----------
12 2
15 1
----------
9 3
12 2
15 2
63 1
105 1
264 1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P2;
int dx[8]={1,1,1,0,-1,-1,-1,0},dy[8]={-1,0,1,1,1,0,-1,-1};
bool check(int n, int m, int x, int y) {
  if(x<0 || x>=n || y<0 || y>=m) return false;
  return true;
}

const double EPS = 1e-10;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > EPS)   return +1;
  if (cross(b, c) < -EPS)   return -1;
  if (dot(b, c) < -EPS)     return +2;
  if (norm(b) < norm(c)) return -2;
  return 0;
}
vector<P> convex_hull(vector<P> p) {
  int n = p.size(), k = 0;
  sort(p.begin(), p.end());
  vector<P> q(2*n);
  for(int i = 0; i < n; q[k++] = p[i++])
    while(k >= 2 && ccw(q[k-2], q[k-1], p[i]) <= 0) --k;
  for(int i = n-2, t = k+1; i >= 0; q[k++] = p[i--])
    while(k >= t && ccw(q[k-2], q[k-1], p[i]) <= 0) --k;
  q.resize(k-1);
  return q;
}
double porigon_area(vector<P> p) {
  double area=0;
  for(int i=0; i<(int)p.size(); i++) area+=cross(p[i],p[(i+1)%p.size()]);
  return area;
}

int main() {
  bool f=false;
  int n;
  string t;
  while(1) {
    cin >> n;
    if(n==0) break;
    getline(cin,t);
    char s[n][100];
    fill(s[0],s[n],' ');
    for(int i=0; i<n; i++) {
      getline(cin,t);
      for(int j=0; j<t.size(); j++) s[i][j]=t[j];
    }
    map<int,int> m;
    m.clear();
    bool d[n][100];
    memset(d,false,sizeof(d));
    for(int i=0; i<n; i++) {
      for(int j=0; j<100; j++) {
	if(d[i][j] || s[i][j]==' ') continue;
	d[i][j]=true;
	vector<P2> v;
	v.push_back(P2(i,j));
	queue<P2> que;
	que.push(P2(i,j));
	int k=0;
	while(!que.empty()) {
	  P2 p=que.front();que.pop();
	  int nx=p.first,ny=p.second;
	  for(int l=0; l<8; l++) {
	    int x=nx+dx[(l+k)%8],y=ny+dy[(l+k)%8];
	    if(check(n,100,x,y) && !d[x][y] && s[x][y]=='*') {
	      k=(l+k)%8;
	      d[x][y]=true;
	      v.push_back(P2(x,y));
	      que.push(P2(x,y));
	      break;
	    }
	  }
	}
	vector<P> p;
	for(int l=0; l<v.size(); l++) p.push_back(P(v[l].first,v[l].second));
	p=convex_hull(p);
	P q=p[0];
	p[0]=P(0,0);
	p[1]=P(p[1].real()-q.real()+1,p[1].imag()-q.imag());
	p[2]=P(p[2].real()-q.real()+1,p[2].imag()-q.imag()+1);
	p[3]=P(p[3].real()-q.real(),p[3].imag()-q.imag()+1);
	  
	m[(int)porigon_area(p)/2]++;
      }
    }
    if(f) cout << "----------" << endl;
    for(map<int,int>::iterator it=m.begin(); it!=m.end(); it++) cout << it->first << " " << it->second << endl;
    f=true;
  }
  return 0;
}