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 <algorithm>
#include <string>
#include <cstring>
#include <map>

using namespace std;


vector<string> vs;
bool used[1010][100];

int search(int x,int y){
  // 0->ツ右,1->ツ可コ,2->ツ債カ,3->ツ湘」
  int sit=0;
  int cx=x;
  int cy=y;
  int over=1;
  int under=1;
  int high=0;
  int dx=1;
  int dy=0;
  int miny=10000000;
  int maxy=-1000000;
  while(1){
    used[cy][cx]=true;
    int nx=cx+dx;
    int ny=cy+dy;
    if(nx>=0&&ny>=0&&ny<vs.size()&&nx<vs[ny].size()
       &&vs[ny][nx]=='*'){
      cx=nx;
      cy=ny;
      miny=min(miny,ny);
      maxy=max(maxy,ny);
      if(sit==0)
	over++;
      else if(sit==2)
	under++;
      if(sit==3&&ny==y&&nx==x)
	break;
    }
    // ツ暗堋督ョツ陛サツ古シツづ個陛渉更
    else{
      if(sit==0){
	for(int i = -1; i <=1; i++){
	  int nnx=cx+i;
	  int nny=cy+1;
	  int nnnx=nnx+i;
	  int nnny=nny+1;
	  if(nnx>=0&&nny<vs.size()&&nny>=0&&nnx<vs[nny].size()
	     &&vs[nny][nnx]=='*'
	     &&nnnx>=0&&nnny<vs.size()&&nnny>=0&&nnnx<vs[nnny].size()
	     &&vs[nnny][nnnx]=='*'
	     ){
	    dy=1;
	    dx=i;
	    break;
	  }
	}
	sit=1;
      }
      else if(sit==1){
	// ツ債カツづ鳴暗堋督ョ
	dx=-1;
	dy=0;
	sit=2;
      }
      else if(sit==2){
	// ツ湘」ツづ鳴暗堋督ョ
	for(int i = -1; i <=1; i++){
	  int nnx=cx+i;
	  int nny=cy-1;
	  int nnnx=nnx+i;
	  int nnny=nny-1;
	  if(nnx>=0&&nny<vs.size()&&nny>=0&&nnx<vs[nny].size()
	     &&vs[nny][nnx]=='*'
	     &&nnnx>=0&&nnny<vs.size()&&nnny>=0&&nnnx<vs[nnny].size()
	     &&vs[nnny][nnnx]=='*'
	     ){
	    dy=-1;
	    dx=i;
	    break;
	  }
	}
	sit=3;
      }
    }
  }
  int res=(over+under)*(abs(miny-maxy)+1)/2;
  return res;
}

int main(){

  int n;
  bool b=false;
  while(cin>>n&&n!=0){
    if(b){
      cout<<"----------"<<endl;
    }
    b=true;
    memset(used,0,sizeof(used));
    int maxLength=0;
    string str;
    getline(cin,str);
    for(int i = 0; i < n; i++){
      getline(cin,str);
      vs.push_back(str);
      maxLength=max(maxLength,(int)str.size());
    }
    for(int i = 0; i < n; i++){
      int diff=maxLength-vs[i].size();
      for(int j = 0; j < diff; j++){
	vs[i]+=' ';
      }
    }
    map<int,int> mii;
    int res=0;
    for(int i = 0; i < vs.size(); i++)
      for(int j= 0;j<vs[i].size();j++)
	if(vs[i][j]=='*'&&!used[i][j])
	  mii[search(j,i)]++;
    for(map<int,int>::iterator it=mii.begin();it!=mii.end();it++)
      cout<<it->first<<" "<<it->second<<endl;
    vs.clear();
  }
  return 0;
}