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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

enum Type{
	Hidarishita,
	Mashita,
	Migishita,
};

struct Info{
	bool operator<(const struct Info &arg) const{
		return S < arg.S;
	}
	int S,num;
};

char table[1000][81];
bool check[1000][81];
int width[1000];
int test_case = 0;
int H;
int diff_row[3] = {1,1,1},diff_col[3] = {-1,0,1};
Type type_array[3] = {Hidarishita,Mashita,Migishita};

bool rangeCheck(int row,int col){

	if(row < 0 || row >= H)return false;

	if(col < 0 || col >= width[row])return false;

	return true;
}


void func(){

	if(test_case != 0){
		printf("----------\n");
	}
	test_case++;

	getchar();

	int length;
	for(int row = 0; row < H; row++){
		fgets(table[row],80,stdin);
		for(length = 0; table[row][length] != '\0' && table[row][length] != '\n'; length++){
			check[row][length] = false;
		}
		width[row] = length;
	}

	vector<Info> V;

	int jyoutei,katei,height,tmp_S;
	int adj_row,adj_col,hidarishita_col,migishita_col;
	Type dir;

	bool FLG;

	for(int row = 0; row < H; row++){
		for(int col = 0; table[row][col] != '\0'; col++){
			if(table[row][col] != '*' || check[row][col] == true)continue;

			jyoutei = 0,katei = 0,height = 0;

			for(int tmp_col = col; table[row][tmp_col] == '*';tmp_col++){
				check[row][tmp_col] = true;
				jyoutei++;
			}

			for(int i = 0; i < 3; i++){
				adj_row = row + diff_row[i];
				adj_col = col + diff_col[i];

				if(!rangeCheck(adj_row,adj_col))continue;

				if(table[adj_row][adj_col] == '*' && check[adj_row][adj_col] == false){
					dir = type_array[i];
					break;
				}
			}

			for(int tmp_row = row,tmp_col = col;rangeCheck(tmp_row,tmp_col) == true && table[tmp_row][tmp_col] == '*';tmp_row += diff_row[dir],tmp_col+=diff_col[dir]){
				check[tmp_row][tmp_col] = true;
				height++;
				hidarishita_col = tmp_col;
			}

			for(int i = 0; i < 3; i++){
				adj_row = row + diff_row[i];
				adj_col = (col+jyoutei-1) + diff_col[i];

				if(!rangeCheck(adj_row,adj_col))continue;

				if(table[adj_row][adj_col] == '*' && check[adj_row][adj_col] == false){
					dir = type_array[i];
					break;
				}
			}

			for(int tmp_row = row,tmp_col = col+jyoutei-1;rangeCheck(tmp_row,tmp_col) == true && table[tmp_row][tmp_col] == '*';tmp_row += diff_row[dir],tmp_col+=diff_col[dir]){
				check[tmp_row][tmp_col] = true;
				migishita_col = tmp_col;
			}

			katei = migishita_col-hidarishita_col+1;

			for(int tmp_row = row+height-1,tmp_col = hidarishita_col; tmp_col <= migishita_col; tmp_col++)check[tmp_row][tmp_col] = true;

			tmp_S = ((jyoutei+katei)*height)/2;

			FLG = true;

			for(int i = 0; i < V.size(); i++){
				if(V[i].S == tmp_S){
					V[i].num++;
					FLG = false;
					break;
				}
			}

			if(FLG){
				Info new_info;
				new_info.S = tmp_S;
				new_info.num = 1;
				V.push_back(new_info);
			}
		}
	}

	sort(V.begin(),V.end());

	for(int i = 0; i < V.size(); i++){
		printf("%d %d\n",V[i].S,V[i].num);
	}
}

int main(){

	while(true){
		scanf("%d",&H);
		if(H == 0)break;

		func();
	}

	return 0;
}