def dfs(fld, check, sy, depth)
  ok = true
  ny = -1
  (sy...fld.size).each do |y|
    (0...fld[y].size).each do |x|
      if check[y][x] == depth && fld[y][x] == '*'
        ny = y if ny == -1
        l = r = x
        loop do
          check[y][r] = depth + 1
          break if fld[y][r+1] != '*'
          r += 1
        end
        ml, mr = fld[y+1][l-1..r+1].map.with_index(l-1){ |e, i| i if e == '*' }.compact
        ml -= l; mr -= r

        yy = y + 1; xl = l + ml; xr = r + mr
        loop do
          check[yy][xl] = check[yy][xr] = depth + 1
          (xl+1...xr).each{ |k| check[yy][k] = depth + 2 }
          if fld[yy + 1][xl + ml] != '*'
            (xl+1...xr).each{ |k| check[yy][k] = depth + 1 }
            break
          end
          yy += 1; xl += ml; xr += mr
        end

        s = ((r - l + 1) + (xr - xl + 1)) * (yy - y + 1) / 2
        $ret[s] ||= 0
        $ret[s] += 1
        ok = false
      end
    end
  end
  return true if ok
  return true if dfs(fld, check, ny, depth + 2)
end

l = false
while n = gets.to_i
  break if n == 0
  if l
    10.times{ print '-' }
    puts
  end
  l = true
  fld = [*n.times.map{ [' ', *gets.chomp.split(''), ' '] }, [' '] * 100]
  $ret = {}
  check = (n+1).times.map{ [0] * 100 }
  dfs(fld, check, 0, 0)
  $ret.sort.each{ |k, v| puts "#{k} #{v}" }
end