#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <sstream>
#include <math.h>
#include <boost/math/common_factor.hpp>

using namespace std;

string check(string str);
map<char, int> create_table();

int main(){
  char ch = 'a';
  string str;
  int num;
  vector<string> answers;
  map<char,int> table = create_table();
  cin >> num;

  cin.ignore();
  for(int k=0; k<num; k++){
    getline(cin, str);

    char c;
    char list[1];
    bool flag = true;
    int beta;
    int alpha = 1;
    map<char, int>::iterator itr;
    while(flag){
      if(boost::math::gcd(alpha,26) == 1){ 
        for(beta=1; beta<26; beta++){
          string result;
          for(int i=0; i<str.size(); i++){
            c = str[i];
            if(c != ' '){
              sprintf(list, "%c", ch+(19*table[c]+20)%26);
              result += list[0];
            }else{
              result += ' ';
            }
          }
          if(result.find("this",0) !=string::npos || result.find("that",0) != string::npos){
            answers.push_back(result);
            flag = false;
            break;
          }
        }
      }
      alpha++;
    }
  }

  for(int j=0; j<answers.size(); j++){
    cout << answers[j] << endl;
  }
  return 0;
}


map<char, int> create_table(){
  map<char, int> table;
  char ch[1];
  char str = 'a';

  for(int i=0; i<26; i++){
    sprintf(ch, "%c", str+i); 
    table.insert(pair<char,int>(ch[0],i));
  }
  return table;
}