#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
using namespace std;

bool isFirst(string& s) {
    if(s == "B") return true;
    if(s.length() != 2) return false;
    for(int i = 0; i < 2; ++i)
        if(s[i] < 'A' || s[i] > 'Z') return false;
    return true;
}

bool isSecond(string& s, bool b) {
    if(s.length() == 2 || (s.length() == 3 && b)) {
        for(char c : s) {
            if(c < '0' || c > '9') return false;
        }
        return true;
    }
    return false;
}

bool isThird(string& s) {
    if(s.length() != 3) return false;
    for(int i = 0; i < 3; ++i)
        if(s[i] < 'A' || s[i] > 'Z')
            return false;
    return true;
}

int main() {
    int n;
    cin >> n;
    char buf[30] = {0};
    gets(buf);
    
    for(int i = 0; i < n; ++i) {
        
        gets(buf);
        
        //cout << buf << endl;
        
        char s[4][30] = {0};
        string ss[4];
        sscanf(buf, "%s%s%s%s", s[0], s[1], s[2], s[3]);
        bool ok = ss[3].empty();
        int sum = 0;
        for(int j = 0; j < 4; ++j) {
            ss[j] = string(s[j]);
            sum += ss[j].length();
        }
        ok &= (strlen(buf) == sum + 2);
        
        if(ss[0] == "B") {
            if(!isSecond(ss[1], true))
                ok = 0;
        } else if(isFirst(ss[0])) {
            if(!isSecond(ss[1], false))
                ok = 0;
        }
        else ok = 0;
        ok &= isThird(ss[2]);
        cout << (ok ? "Correct!" : "Incorrect!") << endl;
    }
    
    
    return 0;
}

/*


*/