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 <string>
#include <map>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
using namespace std;

int n;
int ul, bl, h;
const int dy[3] = {0,-1,1};
vector<string> rec(1001);
bool flag = false;

int soy(int i, int j){
	ul = bl = 0;
	h = 1;
	
	while( j < rec[i].size() && rec[i][j] == '*'){
		rec[i][j] = ' ';
		//cout << j << " , " << i << endl;
		ul++;
		j++;
	}
	j--;
	int a = -1;
	i++;
	if( i < n && j + 1 < rec[i].size() && rec[i][j+1] == '*'){
		a = 2;
	}else if( i < n && rec[i][j] == '*'){
		a = 0;
	}else if( i < n && j - 1 >= 0 && rec[i][j-1] == '*'){
		a = 1;
	} 
	h++;
	j += dy[a];
	while( i < n && j+dy[a] >= 0 && j+dy[a] < rec[i+1].size() && rec[i+1][j+dy[a]] == '*'){
		rec[i][j] = ' ';
		h++;
		i++;
		j += dy[a];
	}
	//j-=dy[a];
	//i--;
	while( j >= 0 && rec[i][j] == '*'){
		rec[i][j] = ' ';
		bl++;
		j--;
	}
	j++;

	if( i - 1 >= 0 && rec[i-1][j] == '*'){
		a = 0;
	}else if( i - 1 >= 0 && j - 1 >= 0 && rec[i-1][j-1] == '*'){
		a = 1;
	}else if( i - 1 >= 0 && j + 1 < rec[i].size() && rec[i-1][j+1] == '*'){
		a = 2;
	}

	for( int b = 0; b < h-1; b++){
		j += dy[a];
		rec[i-b-1][j] = ' ';
	}
	//cout << ul << " " << bl  << " " << h << endl;
	return (ul + bl) * h / 2;
}

int main(){
	while(cin >> n, n){
		int ans[10000] = {0};
		char stj[100];
		gets(stj);
		for(int i = 0; i < n; i++){
			rec[i].resize(0);
			char tmpc[1080];
			gets(tmpc);
			int j = 0;
			while(tmpc[j]){
				rec[i].push_back(tmpc[j]);
				j++;
			}
			//cout << rec[i] << endl;
		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < rec[i].size(); j++){
				if( rec[i][j] == '*'){
					int t = soy(i,j);
					ans[t]++;
				}
			}
		}
		if(flag) cout << "----------" << endl;
		else flag = true;
		for(int i = 0; i < 10000; i++){
			if(ans[i] != 0){
				cout << i << ' ' << ans[i] << endl;
			}
		}
	}	
}