### main

not_first = false

loop do
  h = gets.to_i
  break if h == 0

  lines = h.times.map{gets.chomp}

  w = lines.map{|l| l.length}.max
  lines.map!{|l| l + ' ' * (w - l.length)}
  #p [w, h]
  #lines.each{|l| p l}

  arhash = {}
  
  for y0 in (0...h)
    for x0 in (0...w)
      next if lines[y0][x0] == ' '

      tx0 = tx1 = x0
      ty = y0
      lines[ty][tx0] = ' '
      for tx in ((tx0 + 1)...w)
        break if lines[ty][tx] == ' '
        tx1 = tx
        lines[ty][tx] = ' '
      end

      by = ty + 1
      for dx in (-1..1)
        bx0 = tx0 + dx
        break if bx0 >= 0 && bx0 < w && lines[by][bx0] == '*'
      end
      bx0 = tx0 + dx
      while by < h && bx0 >= 0 && bx0 < w && lines[by][bx0] == '*'
        lines[by][bx0] = ' '
        by += 1
        bx0 += dx
      end
      by -= 1
      bx0 -= dx

      for dx in (-1..1)
        bx1 = tx1 + dx
        break if bx1 >= 0 && bx1 < w && lines[ty + 1][bx1] == '*'
      end
      bx1 = tx1
      for y in ((ty + 1)..by)
        bx1 += dx
        lines[y][bx1] = ' '
      end

      for x in ((bx0 + 1)...bx1)
        lines[by][x] = ' '
      end
      #p [[tx0, ty], [tx1, ty], [bx0, by], [bx1, by]];
      #lines.each{|l| p l}; exit

      ar = ((tx1 - tx0 + 1) + (bx1 - bx0 + 1)) * (by - ty + 1) / 2
      #p ar

      if arhash[ar].nil?
        arhash[ar] = 1
      else
        arhash[ar] += 1
      end
    end
  end

  puts '-' * 10 if not_first
  not_first = true

  for ar in arhash.keys.sort
    puts [ar, arhash[ar]].join(' ')
  end
end