#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int alp[12] ={1,3,5,7,9,11,15,17,19,21,23,25};
int main()
{
  string str;
  string temp;
  int n;
  scanf("%d\n",&n);
  bool flag = false;
  for(int i = 0;i < n;i++){
    getline(cin,str);
    temp = str;
    if(!flag){
      for(int j = 0;j <12;j++){//α
	for(int k = 0; k <=26;k++){//β
	  if(!flag&&(temp.find("this") !=string::npos||temp.find("that")!=string::npos)){
	    cout <<temp<<endl;
	    flag = true;
	    break;
	  }
	  for(int l = 0;l <str.length();l++){
	    if(str[l] >= 'a' && str[l] <= 'z'){
	      temp[l] =((((str[l]-'a')*alp[j])+k)%26)+'a';
	    }
	  }
	}
      }
    }
  }
  return 0;
}