// #pragma GCC optimize("03,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <bitset>
#include <set>
#include <unordered_set>
#include <utility>
#include <numeric>
#include <iomanip>
#include <stack>
#include <list>
#include <bitset>
#include <sstream>
#include <random>
#include <stdlib.h>
#include <time.h>
#define ll long long
#define ld long double
#define INF 0x3f3f3f3f
#define MXN 2000005
#define cl(x) (x << 1)
#define cr(x) ((x << 1) | 1)
#define SZ(x) (int)x.size()
#define PB push_back
#define lowbit(x) (x & (-x))
#define NO_TAG false
#define P1 75577
#define P2 12721
#define MOD1 998244353
#define MOD2 1000000007
using namespace std;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
int rand_int(int lb, int ub) {
return uniform_int_distribution<int>(lb, ub)(gen);
}
unordered_map<string, char> mp;
void build(string a, char b) {
mp[a] = b;
}
void init() {
build("UUU", 'F');
build("UUC", 'F');
build("UUA", 'L');
build("UUG", 'L');
build("CUU", 'L');
build("CUC", 'L');
build("CUA", 'L');
build("CUG", 'L');
build("AUU", 'I');
build("AUC", 'I');
build("AUA", 'I');
build("AUG", 'M');
build("GUU", 'V');
build("GUC", 'V');
build("GUA", 'V');
build("GUG", 'V');
build("UCU", 'S');
build("UCC", 'S');
build("UCA", 'S');
build("UCG", 'S');
build("AGU", 'S');
build("AGC", 'S');
build("CCU", 'P');
build("CCC", 'P');
build("CCA", 'P');
build("CCG", 'P');
build("ACU", 'T');
build("ACC", 'T');
build("ACA", 'T');
build("ACG", 'T');
build("GCU", 'A');
build("GCC", 'A');
build("GCA", 'A');
build("GCG", 'A');
build("UAU", 'Y');
build("UAC", 'Y');
build("CAU", 'H');
build("CAC", 'H');
build("CAA", 'Q');
build("CAG", 'Q');
build("AAU", 'N');
build("AAC", 'N');
build("AAA", 'K');
build("AAG", 'K');
build("GAU", 'D');
build("GAC", 'D');
build("GAA", 'E');
build("GAG", 'E');
build("UGU", 'C');
build("UGC", 'C');
build("UGG", 'W');
build("CGU", 'R');
build("CGC", 'R');
build("CGA", 'R');
build("CGG", 'R');
build("AGA", 'R');
build("AGG", 'R');
build("GGU", 'G');
build("GGC", 'G');
build("GGA", 'G');
build("GGG", 'G');
build("UAA", '$');
build("UAG", '$');
build("UGA", '$');
}
void solve() {
// 靠邀,我頭很痛。
// 啊我微積分就退選,你覺得我看起來像會看懂題目的人嗎?
string s;
cin >> s;
string res = "";
int n = s.size();
for (int i = 0; i < n; i += 3) {
string tmp = s.substr(i, 3);
if (mp[tmp] == '$') {
break;
}
res.push_back(mp[tmp]);
}
cout << res << "\n";
return ;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
init();
while (t--) {
solve();
}
return 0;
}