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<cmath>
#include<algorithm>
#include<map>
#include<cassert>
#include<vector>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS (1e-10) 
using namespace std;
bool used[1000][80];
int dx[] = {-1,+0,+1,+1,+1,+0,-1,-1};
int dy[] = {+1,+1,+1,+0,-1,-1,-1,+0};

class Point
{
 public:

 double x,y;

 Point(double x = -1,double y = -1): x(x),y(y){}

 Point operator + (Point p ){return Point(x+p.x,y+p.y);}
 Point operator - (Point p){return Point(x-p.x,y-p.y);}
 Point operator * (double a){return Point(a*x,a*y);}
 Point operator / (double a){return Point(x/a,y/a);}//※イケメンに限る

 bool operator < (const Point& p) const
 {
   return y != p.y?y<p.y:x<p.x;
 }

 bool operator == (const Point& p)const
 {
   return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
 }
};

struct Segment
{
 Point p1,p2;
 Segment(Point p1 = Point(-1,-1),Point p2 = Point(-1,-1)):p1(p1),p2(p2){}
};

typedef Point Vector;
typedef Segment Line;
typedef vector<Point> Polygon;

double dot(Point a,Point b)
{
 return a.x*b.x + a.y*b.y;
}


double cross(Point a,Point b)
{
 return a.x*b.y - a.y*b.x;
}

double norm(Point a)
{
 return a.x*a.x+a.y*a.y;
}

void dfs(int x,int y,vector<Point> &vec,vector<string> &G,int H)
{
  if(used[y][x])return;
  used[y][x] = true;
  vec.push_back(Point(x,y));

  rep(i,8)
    {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if(!(0 <= ny && ny < H && 0 <= nx && nx < G[ny].size()))continue;
      if(G[ny][nx] == '*' && !used[ny][nx])
	{
	  dfs(nx,ny,vec,G,H);
	  return;
	}
    }

}

int calc(vector<Point> &vec)
{
  int res = 0;
  //cout << "vec[] = " << vec.size() << endl;
  rep(i,vec.size())
    {
      int j,cnt = 0;
      for(j=i;j<vec.size() && vec[j].y == vec[i].y;j++,cnt++);
      assert(cnt >= 2);
      if(cnt == 2)
	res += vec[i+1].x-vec[i].x+1;
      else 
	res += cnt;
      i = j-1;
    }
  return res;
}

int main()
{
  int n;
  bool f = true;
  while(cin >> n,n)
    {
      cin.ignore(); 
      vector<string> G(n);
      string input;
      rep(i,n)
	{
	  getline(cin,input);
	  G[i] = input;
	}

      rep(i,n)rep(j,G[i].size())used[i][j] = false;

      map<int,int> ans;

      rep(i,n)
	{
	  rep(j,G[i].size())
	    {
	      if(G[i][j] != '*')continue;
	      if(used[i][j])continue;
	      vector<Point> vec;
	      dfs(j,i,vec,G,n);
	      /*
 rep(k,vec.size())
		cout << vec[k].x << "," << vec[k].y << endl;
	      cout << endl;
	      */
sort(vec.begin(),vec.end());

	      
	      int area = calc(vec);
	      ans[area]++;
	    }
	}

      if(f)f = false;
      else cout << "----------" <<endl;

      for(map<int,int>::iterator it = ans.begin();it != ans.end();it++)
	cout << it->first << " " << it->second << endl;

    }
  return 0;
}