import java.util.Scanner; import java.util.regex.Pattern; import java.util.regex.Matcher; public class Reading { public static void main(String[] args) throws java.lang.Exception { // Scanner in = new Scanner(new FileReader("input.txt")); Scanner in = new Scanner (System.in) ; int n = Integer.parseInt(in.nextLine()) ; String reg = "" ; Pattern p1 = Pattern.compile("^[A-Z]{2} \\d\\d ([A-Z]{3})$") ; Pattern p2 = Pattern.compile("^B \\d\\d\\d? ([A-Z]{3})$") ; for(int i = 1 ; i <= n ; ++i){ reg = in.nextLine().split("\n")[0]; Matcher mat = p1.matcher(reg) ; Matcher mat1 = p2.matcher(reg) ; if(mat.matches() || mat1.matches()){ System.out.println("Correct!"); }else{ System.out.println("Incorrect!"); } } in.close(); } }