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 <cstring>

using namespace std;

int xdir[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int ydir[8] = {0, 1, 1, 1, 0, -1, -1, -1};

struct Pa{
  int area;
  int num;
};

bool comp(const Pa& p1, const Pa& p2)
{
  return p1.area < p2.area;
}

int p;
void func(char a[1001][81], int s, int t, int prm[5], int dx, int dy)
{
  a[s][t] = ' ';
  for(int i = 0; i < 8; i++){
    if(a[s+ydir[i]][t+xdir[i]] == '*'){
      if(dx == xdir[i] && dy == ydir[i]){
	prm[p]++;
      } else {
	p++;
      }
      func(a, s+ydir[i], t+xdir[i], prm, xdir[i], ydir[i]);
      break;
    }
  }

  return ;
}

int main()
{
  int prm[5], n;
  char a[1001][81];
  bool f = false;
 
  while(cin >> n && n){
    vector<Pa> vec;
    int v = 0;
    cin.getline(a[0], sizeof(a[0]));
    for(int i = 0; i < n; i++){
      cin.getline(a[i], sizeof(a[i]));
    }
    if(f){
      cout << "----------" << endl;
    }

    for(int i = 0; i < n; i++){
      for(int j = 0, l= strlen(a[i]); j < l; j++){
	if(a[i][j] == '*'){
	  p = 0;
	  fill(prm, prm+5, 2);
	  func(a, i, j, prm, 0, 0);
	  int s = (prm[1]+prm[3])*prm[2]/2;
	  f = true;
	  for(int k = 0; k < v; k++){
	    if(vec[k].area == s){
	      vec[k].num++;
	      f = false;
	      break;
	    }
	  }
	  if(f){
	    Pa par;
	    par.area = s;
	    par.num = 1;
	    vec.push_back(par);
	    v++;
	  }
	}
      }
    }

    sort(vec.begin(), vec.end(), comp);
    for(int i = 0; i < v; i++){
      cout << vec[i].area << " " << vec[i].num << endl;
    }

    f = true;
  }

  return 0;
}