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 <array>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

#define REP(i, a, b) for(int i = (a); i < int(b); ++i)
#define rep(i, n) REP(i, 0, n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

enum { LU, RU, LD, RD, NUM};
int h, w;

constexpr int dx[] = { 1, -1,  0,  0,  1, -1,  1, -1};
constexpr int dy[] = { 0,  0,  1, -1,  1, -1, -1,  1};

typedef pair<int, int> point;
#define X first
#define Y second

inline bool out(int x, int y) {
	return x < 0 || y < 0 || x >= w || y >= h;
}

void dfs(const point &current, vector<string> &picture, array<point, NUM> &corner) {
	picture[current.Y][current.X] = ' ';

	if(current.Y < corner[LU].Y) {
		corner[LU] = corner[RU] = current;
	}
	else if(current.Y == corner[LU].Y) {
		chmin(corner[LU], current);
		chmax(corner[RU], current);
	}

	if(current.Y > corner[LD].Y) {
		corner[LD] = corner[RD] = current;
	}
	else if(current.Y == corner[LD].Y) {
		chmin(corner[LD], current);
		chmax(corner[RD], current);
	}

	rep(d, 8) {
		const int nx = current.X + dx[d];
		const int ny = current.Y + dy[d];

		if(!out(nx, ny) && picture[ny][nx] == '*') {
			dfs(point(nx, ny), picture, corner);
		}
	}
}

int area(int x, int y, vector<string> &picture) {
	array<point, NUM> corner{{point(w, h), point(0, h), point(w, 0), point(0, 0)}};
	dfs(point(x, y), picture, corner);
	const int tw = corner[RU].X - corner[LU].X + corner[RD].X - corner[LD].X + 2;
	const int ty = corner[LD].Y - corner[LU].Y + 1;
	return tw * ty / 2;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	bool first = true;
	const string bar(10, '-');
	while(cin >> h && h) {
		cin.ignore();

		if(first) first = false;
		else cout << bar << endl;

		vector<string> picture(h);
		w = 0;
		for(auto &e : picture) {
			getline(cin, e);
			chmax<int>(w, e.size());
		}

		for(auto &e : picture) e = (e + string(w, ' ')).substr(0, w);

		map<int, int> trapezoids;
		rep(y, h) {
			rep(x, w) {
				if(picture[y][x] == '*') {
					++trapezoids[area(x, y, picture)];
				}
			}
		}

		for(const auto &e : trapezoids) {
			cout << e.first << ' ' << e.second << endl;
		}
	}

	return EXIT_SUCCESS;
}