#include #include using namespace std; int n,ok,m,ok1; char s[40]; int main() { //freopen("input","r",stdin); //freopen("output","w",stdout); scanf("%d\n",&n); for(int i=1;i<=n;i++) { ok=0; scanf("%s",&s); m=strlen(s)-1; if(m>1){printf("Incorrect!\n");gets(s);continue;} if(m==0)ok=1; if(ok==1&&s[0]!='B'){printf("Incorrect!\n");gets(s);continue;} ok1=0; for(int j=0;j<=m&&ok1==0;j++) if(s[j]<'A'||s[j]>'Z'){printf("Incorrect!\n");gets(s);ok1=1;} if(ok1==1)continue; scanf("%s",&s); m=strlen(s)-1; if(m!=1&&ok==0){printf("Incorrect!\n");gets(s);continue;} if(ok==1&&m!=1&&m!=2){printf("Incorrect!\n");gets(s);continue;} for(int j=0;j<=m&&ok1==0;j++) if(s[j]<'0'||s[j]>'9'){printf("Incorrect!\n");gets(s);ok1=1;} if(ok1==1)continue; scanf("%s",&s); m=strlen(s)-1; if(m!=2){printf("Incorrect!\n");gets(s);continue;} for(int j=0;j<=m&&ok1==0;j++) if(s[j]<'A'||s[j]>'Z'){printf("Incorrect!\n");gets(s);ok1=1;} if(ok1==1)continue; printf("Correct!\n"); } return 0; }