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<iostream>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<complex>

using namespace std;

#define fr first
#define sc second

const int di[] = {-1,-1,0,1,1,1,0,-1};
const int dj[] = {0,1,1,1,0,-1,-1,-1};

typedef pair<int,int> pi;
typedef pair< pi, pi > ppi;
typedef double elem;
typedef complex<elem> point;

elem cross(point a, point b){
  return a.real() * b.imag() - a.imag() * b.real();
}

class State
{
public:
  int dir;
  int i,j;  
  State():i(0),j(0){}
  State(int d, int i, int j):dir(d),i(i),j(j){}
};

void bfs(int M[][84], const State &init, vector<point> &bends){
  queue<State> qs;
  qs.push(init);
  bends.push_back( point(init.j,init.i) );
  int n = 0;
  while(!qs.empty()){
    State now = qs.front();
    qs.pop();
    //cout << now.i << ' ' << now.j << endl;
    M[now.i][now.j] = 0;
    for(int i = now.dir; i < 8+now.dir; ++i){
      int t = i%8;
      if( M[now.i+di[t]][now.j+dj[t]] == 1 ){
	State next( t, now.i+di[t], now.j+dj[t] );
	qs.push( next );
	if( t != now.dir && n > 0 ){
	  bends.push_back( point( now.j, now.i ) );
	}
	break;
      }
    }
    ++n;
  }
}

elem area(const vector<point> &v)
{
  elem ret = 0;
  int n = v.size();
  for(int i = 0; i < v.size(); ++i){
    ret += cross( v[i], v[(i+1)%n] );
  }
  return ret/2.0;
}

int main()
{
  int tc = 0;
  while(true){
    int M[1003][84]={{0,},};
    string s;
    map<int,int> ans;
    int h;
    cin >> h;
    if( h == 0 )break;
    getline(cin,s);
    if( tc > 0 )
      cout << "----------" << endl;
    ++tc;
    for(int i = 0; i < h; ++i){
      getline(cin,s);
      for(int j = 0; j < s.length(); ++j){
	M[i+1][j+1] = (s[j] == '*' ? 1 : 0);
      }
    }
    for(int i = 0; i < h; ++i){
      for(int j = 0; j < 82; ++j){
	if( M[i+1][j+1] == 1 ){
	  vector<point> bends;
	  bfs( M, State(2,i+1,j+1), bends );
	  for(int k = 0; k < bends.size(); ++k){
	    if( k == 1 )
	      bends[k] = bends[k] + point(1,0);
	    if( k == 2 )
	      bends[k] = bends[k] + point(1,1);
	    if( k == 3 ){
	      bends[k] = bends[k] + point(0,1);
	    }
	    //cout << bends[k] << ' ';
	  }
	  int A = (int)area(bends);
	  ans[A ]++;
	}
      }
    }
    for(map<int,int>::iterator itm = ans.begin();
	itm != ans.end();
	++itm)
      {
	cout << itm->first << ' ' << itm->second << endl;
      }
  }
  return 0;
}