#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL << 30)
#define LLINF (1LL << 60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void) {
  int n;
  string s;
  cin >> n;
  while(getline(cin, s)) {
    //cout << o << endl;
    for (int i = 1; i < 26; i += 2) {
      if (i == 13)
        continue;
      REP(j, 26) {
        string t = s;
        REP(k, t.size()) {
          if (t[k] == ' ')
            continue;
          t[k] = (char)('a' + (i * (t[k] - 'a') + j) % 26);
        }
        if (t.find("this") != string::npos || t.find("that") != string::npos) {
          cout << t << endl;
          break;
        }
      }
    }
  }

  return 0;
}