#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
int h[12][12],v[12][12];
int s[10] = {0};
int m,n;
int cnt=1;
void found(int x,int y)
{
for(int ce=0 ; ce<min(m-x,m-y) ; ce++)
{
for(int i =0 ; i<ce+1 ; i++)
{
if(h[x+i][y]!=1 || h[x+i][y+ce+1]!=1)
break;
if(v[x][y+i]!=1 || v[x+ce+1][y+i]!=1)
break;
if(i==ce)
s[ce]++;
}
}
}
int main()
{
while(scanf("%d%d",&m,&n)!=-1)
{
getchar();
memset(h,0,sizeof(h));
memset(v,0,sizeof(v));
memset(s,0,sizeof(s));
for(int i=0; i<n; i++)
{
char c;
int x,y;
scanf("%c%d%d",&c,&x,&y);
getchar();
if(c=='H')
h[y-1][x-1]=1;
else
v[x-1][y-1]=1;
}
for(int i=0; i<m; i++)
for(int j=0 ; j<m; j++)
if(h[i][j]==1&&v[i][j]==1)
found(i,j);
int flog=1;
if(cnt>1) printf("
**********************************
");
printf("Problem #%d
",cnt++);
for(int i=0; i<m; i++)
if(s[i]>0)
{
flog=0;
printf("%d square (s) of size %d
",s[i],i+1);
}
if(flog) printf("No completed squares can be found.
");
}
return 0;
}
//千万不要在乱用flog;