#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

char change(int a,int b, char c){
  if(c == ' ')return c;
  return 'a' + (a * (c - 'a') + b) % 26;
}
int main(void){
  int a[] = {1,3,5,7,9,11,15,17,19,21,23,25,0};
  int n; cin>>n; cin.ignore();
  string str,str_cp,sp = " ";
  
  while(getline(cin,str)){
    str = str_cp = sp + str + sp;
    bool f = false;
    for(int i = 0 ; !f && a[i] ; i ++){
      for(int b = 0 ; !f && b < 26 ; b ++){
	for(int j = 0 ; j < str.length() ; j ++){
	  str[j] = change(a[i],b,str[j]);
	}
	if(str.find(" that ") != string::npos
	   || str.find(" this ") != string::npos){
	  f = true;
	  break;
	}

	str = str_cp;
      }
    }
    cout<<str.substr(1,str.length() - 2)<<endl;
  }
}