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 <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0
#define all(x) x.begin(), x.end()


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

int n;
char check[1010][82];
char field[1010][82];
map<int,int> mii;

bool inside(int x, int y){
  return !(x>=80 || y>=n || x<0 || y<0 || field[y][x]==0 );
}

void dfs(int x, int y, int d, vector<pair<int,int> >& v){
  int tx = x + dx[d];
  int ty = y + dy[d];

  if( check[y][x] ) return;
  check[y][x] = 1;

  if( inside(tx,ty) && field[ty][tx]=='*' ){
    dfs(tx,ty,d,v);
  }else{
    v.push_back(make_pair(x,y));
    rep(k,8){
      tx = x + dx[k];
      ty = y + dy[k];
      if( !inside(tx,ty) || field[ty][tx]==' ' || check[ty][tx] )continue;
      dfs(tx,ty,k,v);
    }
  }
}

int main(){
  string in;
  for(int t=0; cin>>n,n; t++){
    cin.ignore();
    memset(field,0,sizeof(field));
    memset(check,0,sizeof(check));
    mii.clear();
    if( t>0 )puts("----------");
    
    rep(i,n){
      getline(cin,in);
      strcpy(field[i], in.c_str());
    }
    rep(i,n){
      for(int j=0; field[i][j]!='\0'; j++){
	if( field[i][j]=='*' && !check[i][j] ){
	  int d = -1;
	  rep(k,8){
	    int tx = j + dx[k];
	    int ty = i + dy[k];
	    if( !inside(tx,ty) || field[ty][tx]==' ' ) continue;
	    d = k;
	    break;
	  }
	  vector<pair<int,int> > v;
	  v.push_back(make_pair(j,i));
	  dfs(j, i, d, v);

#if DEB
	  rep(k,v.size()){
	    printf("(%d,%d)\n",v[k].first, v[k].second);
	  }
#endif
	  
	  int sum = ((v[1].first-v[0].first+1)+(v[2].first-v[3].first+1))*(v[3].second-v[0].second+1)/2;
	  //int sum = ((v[3].first-v[0].first+1)+(v[2].first-v[1].first+1))*(v[1].second-v[0].second+1)/2;
	  mii[sum]++;
	}
      }
    }
    map<int,int>::iterator it;
    for(it=mii.begin(); it!=mii.end(); it++){
      printf("%d %d\n",it->first, it->second);
    }
#if DEB
    rep(i,n){
      rep(j,81){
	printf("%d",check[i][j]);
      }
      puts("");
    }
#endif
  }
  return 0;
}