#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int alpha,beta;

char function(char c){

	//文字を数字に変える。
	int num = c-'a';

	int tmp = (alpha*num+beta)%26;

	char ans = (char)tmp + 'a';

	return ans;


}

int main(){
	alpha = 3;
	beta = 2;

	int n;
	cin>>n;

	for(int i=0;i<n;i++){
		string str;
		cin.ignore();
		getline(cin,str);

		char tmp[260];
		int breakFlag=0;
		for(alpha = 0;alpha<1000;alpha++){
			for(beta = 0;beta<26;beta++){
				for(int j=0;j<str.size();j++){
					if(str[j]==' '){
						tmp[j] = ' ';
					}
					else{
						tmp[j] = function(str[j]);
					}
				}
				/*
				for(int j=0;j<str.size();j++){
					cout<<tmp[j];
				}
				cout<<endl;
				*/
				for(int j=0;j<str.size()-3;j++){
					if(tmp[j]=='t'&&tmp[j+1]=='h'&&tmp[j+2]=='i'&&tmp[j+3]=='s'){
						breakFlag=1;
						break;
					}
					if(tmp[j]=='t'&&tmp[j+1]=='h'&&tmp[j+2]=='a'&&tmp[j+3]=='t'){
						breakFlag=1;
						break;
					}
				}
				if(breakFlag==1){
					break;
				}
			}
			if(breakFlag == 1){
				break;
			}
		}
		for(int j=0;j<str.size();j++){
			cout<<tmp[j];
		}
		cout<<endl;
	}

	return 0;


}

/*
Sample Input
1
y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
Output for the Sample Input
i submit that there is another point of view
*/