#include <iostream>
#include <string>

using namespace std;
struct plate {
    string county;
    string numbers;
    string letters;
};

bool isCountyValid(string county) {
    int countyLength = county.length();

    if (countyLength > 2) return false;

    if (countyLength == 1 && county != "B") {
        return false;
    }

    for (char const& c : county) {
        if (islower(c)) return false;
    }

    return true;
}

bool isNumbersValid(string numbers, string county) {
    bool isBucharest = county == "B";
    int numbersLength = numbers.length();

    if (!(numbersLength == 2 || (isBucharest && numbersLength == 3))) return false;

    for (char const& c : numbers) {
        if (!isdigit(c)) return false;
    }

    return true;
}

bool isLettersValid(string letters) {
    int lettersLength = letters.length();

    if (lettersLength != 3) return false;

    for (char const& c : letters) {
        if (islower(c)) return false;
    }

    return true;
}

int main()
{
    int N = 0;
    cin >> N;
    cin.ignore();

    string* rows = new string[N];
    plate* plates = new plate[N];
    bool* valid = new bool[N];
    for (int i = 0; i < N; i++) {
        getline(cin, rows[i]);
        valid[i] = true;
    }

    for (int i = 0; i < N; i++) {
        string currentWord;
        int wordIndex = 0;

        for (auto c : rows[i]) {
            if (c == ' ') {
                if (wordIndex == 0) plates[i].county = currentWord;
                if (wordIndex == 1) plates[i].numbers = currentWord;
                if (wordIndex == 2) plates[i].letters = currentWord;

                wordIndex++;
                currentWord.erase();
            }
            else {
                currentWord += c;
            }
        }

        if (wordIndex == 2) plates[i].letters = currentWord;
        //if (wordIndex > 3) valid[i] = false;
    }

    for (int i = 0; i < N; i++) {
        string county = plates[i].county;
        string numbers = plates[i].numbers;
        string letters = plates[i].letters;

        if (!isCountyValid(county)) {
            valid[i] = false;
            continue;
        }

        if (!isNumbersValid(numbers, county)) {
            valid[i] = false;
            continue;
        }

        if (!isLettersValid(letters)) {
            valid[i] = false;
            continue;
        }
    }

    for (int i = 0; i < N; i++) {
        string message = valid[i] ? "Correct!" : "Incorrect!";
        cout << message;
        if (i < N - 1) cout << endl;
    }

    return 0;
}