const cif=['0','1','2','3','4','5','6','7','8','9']; var grup_j,grup_b,grup2_b,grup2_j:boolean; tipar,i,n,k:integer; s:array[1..20] of string[20]; begin write('n=');readln(n); for i:=1 to n do begin write('s[',i,']=');readln(s[i]); end; for i:=1 to n do begin grup_j:=false; grup_b:=false; grup2_b:=false; grup2_j:=false; tipar:=0; if (s[i][1]='B') and (s[i][2]=' ') then begin grup_b:=true; if ((s[i][3] in cif)and(s[i][4] in cif) and (s[i][5]=' '))or((s[i][3] in cif)and(s[i][4] in cif)and(s[i][5]in cif)and (s[i][6]=' ')) then grup2_b:=true else grup_b:=false; if grup2_b=true then for k:=length(s[i]) downto length(s[i])-2 do if (ord(s[i][k])>=65) and (ord(s[i][k])<=90) then grup_b:=true; end; if (ord(s[i][1])>=65)and(ord(s[i][1])<=90)and(ord(s[i][2])>=65)and(ord(s[i][2])<=90)and(s[i][3]=' ') then begin grup_j:=true; if (s[i][4] in cif)and(s[i][5] in cif)and(s[i][6]=' ') then grup2_j:=true else grup_j:=false; if grup2_j=true then for k:=length(s[i]) downto length(s[i])-2 do if (ord(s[i][k])>=65) and (ord(s[i][k])<=90) then grup_j:=true; end; if grup_b=true then begin tipar:=1;writeln('Correct!');end; if grup_j=true then begin tipar:=1;writeln('Correct!');end; if tipar=0 then writeln('Incorrect!'); end; readln; end.