#include <bits/stdc++.h>
 
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

///*
//    .........................
//    \|||||||||||||||||||||||/
//     -----------------------
//     |                     |
//     |    ____      ____   |
//      |    (*)       (*)  |
//     [|        |          |]
//     [ |       <         | ]
//        |      ____     |
//         \      --     /
//           \          /
//             --------
//               |  |                 ||||
//       ********************       < ||||
//   **** ****************** ****    \   /
//   **** ****************** ****    ****
//   **** ****************** ****   ****
//   **** ****************** ****  ****
//   **** ****************** **** ****
//   **** ****************** ********
//   **** ******************   ****
//   **** ******************     *
//   **** ******************
//   **** ******************
//   **** ******************
//   **** ******************
//   **** ******************
//   **** ------[[[]]]------
//   **** ||||||||||||||||||
//   **** ||||||||||||||||||
//   (:::)||||||||/\|||||||||
//   /|||\ ||||||/  \|||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//      |||||||||    |||||||||
//     |||||||||    |||||||||
//       |     /      \     |
//       ( __ )        ( __ )
//       '    '        '    '
//       |    |        |    |
//       |    \        /    |
//       |    /        \    |
//       |   /          \   |
//       |  |            |  |
//       |  |            |  |
//      /   ]            [   \
//     /   |              |   \
//    """""                """""
 
bool palindrome(string s) {
    for (int i = 0; i < s.length() / 2; i++) {
        if (s[i] != s[s.length() - i - 1]) {
            return false;
        }
    }
    return true;
}
 
class employee {
private:
    int emp_num;
    string emp_name;
public:
    void getinfo() {
        cin >> emp_num >> emp_name;
    }
 
    void showinfo() {
        cout << emp_num << emp_name;
    }
};
 
bool even(int num) {
    if (num % 2 == 0)return true;
    return false;
}
 
void solve() {
    string s;
    cin >> s;
    string g = "abcdefgh", f = "12345678";
    for (int i = 0; i < 8; ++i) {
        if (s[0] != g[i]) {
            cout << g[i] << s[1] << endl;
        }
    }
    for (int i = 0; i < 8; ++i) {
        if (s[1] != f[i]) {
            cout << s[0] << f[i] << endl;
        }
    }
}
 
int main() {
	
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
    fast
    ll t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
 
    system("pause>0");
}