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 JAVA):

Solution:
import java.awt.geom.*;
import java.util.*;

import static java.lang.Math.*;
public class Main {
	final Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	Main(){
		new AOJ1211();
	}
	
	class AOJ1211{
		AOJ1211(){
			int cnt=0;
			while(true){
				N=sc.nextInt();
				if(N==0)	break;
				if(cnt>0)	System.out.println("----------");
				solve();
				++cnt;
			}
		}
		int N;
		final int vx[]={-1,0,1,1,1,0,-1,-1},vy[]={1,1,1,0,-1,-1,-1,0};
		final int offsetx[]={-1,-1,0,0},offsety[]={0,1,1,0};
		void solve(){
			StringBuilder[] str=new StringBuilder[N];
			sc.nextLine();
			for(int i=0; i<N; ++i)	str[i]=new StringBuilder(sc.nextLine());
			TreeMap<Integer,Integer> ans=new TreeMap<Integer,Integer>();
			ArrayList<Point2D> ps = new ArrayList<Point2D>(4);
			for(int y=0; y<N; ++y){
				for(int x=0; x<str[y].length(); ++x){
					if(str[y].charAt(x)=='*'){
						int xx=x, yy=y;
						for(int i=0; i<4; ++i){
							ps.add(new Point2D.Double(xx+offsetx[i],yy+offsety[i]));
							str[yy].setCharAt(xx, '.');
							int v=0;
							while(!(0<=yy+vy[v]&&yy+vy[v]<N&&0<=xx+vx[v]&&xx+vx[v]<str[yy+vy[v]].length()) || str[yy+vy[v]].charAt(xx+vx[v])!='*')	++v;
//							System.out.println("V"+v+" "+xx+","+yy+" "+str[yy].charAt(xx)+" "+str[yy+vy[v]].charAt(xx+vx[v]));
							while(0<=yy+vy[v]&&yy+vy[v]<N&&0<=xx+vx[v]&&xx+vx[v]<str[yy+vy[v]].length() && str[yy+vy[v]].charAt(xx+vx[v])=='*'){
								xx+=vx[v];	yy+=vy[v];
								str[yy].setCharAt(xx, '.');
							}
						}
//						System.out.println(ps);
//						System.out.println(area(ps));
						int area=(int)area(ps);
						if(ans.containsKey(area))	ans.put(area, ans.get(area)+1);
						else	ans.put(area, 1);
						ps.clear();
					}
				}
			}
			for(Map.Entry<Integer, Integer> e:ans.entrySet()){
				System.out.println(e.getKey()+" "+e.getValue());
			}
		}
		double cross(Point2D p1,Point2D p2){
			return p1.getX()*p2.getY() - p2.getX()*p1.getY();
		}
		double area(ArrayList<Point2D> points){
			double ret=0.0;
			for(int i=0; i<points.size(); ++i){
				Point2D p1=points.get(i), p2=points.get((i+1)%points.size());
				ret+=cross(p1, p2);
			}
			return Math.abs(ret)/2.0;
		}
	}
}