#include<iostream>
using namespace std;
enum res {
ENGLISH,
FINNISH,
UNKNOWN
};
res classify(string s) {
if(s == "ae" || s == "ue" || s == "oe" || s == "io" || s == "rd" || s == "ye" || s == "ya" || s == "yo" || s == "yu" || s == "ey" || s == "ay" || s == "iy" || s == "oy" || s == "uy") return ENGLISH;
if(s[0] == 'z' || s[1] == 'z') return ENGLISH;
if(s[0] == 'f' || s[1] == 'f') return ENGLISH;
if(s[0] == 'b' || s[1] == 'b') return ENGLISH;
if(s == "rg" || s == "gr" || s == "cr" || s == "br" || s == "tr" || s == "pr") return ENGLISH;
if(s == "aa" || s == "ee" || s == "ii" || s == "oo" || s == "uu" || s == "yy") return FINNISH;
return UNKNOWN;
}
int main(void) {
int64_t n;
cin >> n;
for(int64_t T=0;T<n;T++) {
string s;
cin >> s;
int64_t fail=0;
for(int64_t i=0;i<s.size()-1;i++) {
string d;
d+=s[i];
d+=s[i+1];
int c=classify(d);
if(c == ENGLISH) {
cout << "QAQ\n";
fail=1;
break;
} else if(c == FINNISH) {
cout << "10-4\n";
fail=2;
break;
}
}
if(!fail) cout << "10-4\n";
}
}