#include using namespace std; char a[4],b[4],c[4]; bool lit() { bool ok=1; if(strlen(c)==3) { for(int i=0;i>t; while(t--) { int kk=1; cin>>a>>b>>c; if(strlen(a)==1&&a[0]=='B') { int ok1=1; int ok2=1; int ok3=lit(); int lg2=strlen(b); if(lg2!=2&&lg2!=3) ok2=0; for(int i=0;i