#include <bits/stdc++.h>

using namespace std;

string solve(string s) {
  stringstream ss(s);
  string a, b, c;
  ss >> a >> b >> c;
  bool buc = 0;
  if(a.length() == 1) {
    if(a != "B")
      goto bad;
    buc = 1;
  } else if(a.length() == 2) {
    for(int i = 0; i < 2; ++i) {
      if(!isalpha(a[i]))
        goto bad;
      if(!isupper(a[i]))
        goto bad;
    }
  }

  for(auto c: b)
    if(!isdigit(c))
      goto bad;

  if(b.length() != 2 && !(b.length() == 3 && buc))
    goto bad;

  if(c.length() != 3)
    goto bad;

  for(auto i: c) 
    if(!isalpha(i) || !isupper(i))
      goto bad;

  return "Correct!";



bad:
  return "Incorrect!";
}

int main() {
  int n;
  cin >> n;
  string s;
    getline(cin, s);
  for(int i = 1; i <= n; ++i) {
    getline(cin, s);
    cout << solve(s) << "\n";
  }
  return 0;
}