//#include<fstream> #include<iostream> #include<vector> #include <string> using namespace std; /*ifstream fin("a.in"); ofstream fout("a.out");*/ int n,m,k,i,j,p,x,y,a[1005][1005],t,l; string s; bool ok; int main() { cin>>n; getline(cin,s); for(i=1;i<=n;i++) { ok=true; getline(cin,s); l=s.length(); for(j=0;j<l;j++) { if(s[j]<= 'z' and s[j]>='a') { ok=false; } } if(ok==false) { cout<<"Incorrect!\n"; } else { if(s[0] <='Z' and s[0]>='A') { if( (s[0]=='B' and s[1]==' ') or (s[0]>='A' and s[0]<='Z' and s[1]>='A' and s[1]<='Z' and s[2]==' ') ) { j=0; while(s[j] != ' ') { j++; } j++; } else { ok=false; } if(ok==false) { cout<<"Incorrect!\n"; } else { //fout<<j<<"\n"; if ((s[j]<='9' and s[j]>='0') and (s[j+1]<='9' and s[j+1]>='0')) { if((s[j+2]==' ') or (s[0]=='B' and s[1]==' ' and (s[j+2]==' ' or (s[j+2]<='9' and s[j+2]>='0' and s[j+3]==' ') ) ) ) { } else { ok=false; } } else { ok=false; } if(ok==false) { cout<<"Incorrect!\n"; } else { k=j; while(s[k]!=' ') { k++; } k++; if((s[k] <='Z' and s[k]>='A') and (s[k+1] <='Z' and s[k+1]>='A') and (s[k+2] <='Z' and s[k+2]>='A') and s[k+3]==NULL) { } else { ok=false; } if(ok==false) { cout<<"Incorrect!\n"; } else { cout<<"Correct!\n"; } //fout<<k<<"\n"; } } } } } }