#include<iostream>
#include<string>
#define NUM 26
using namespace std;

int gcd(int a, int b){
	if(a%b){
		return gcd(b, a%b);
	}
	return b;
}

int main(){
	int a, y, b, n, i, j, k, fy;
	int ay[257];
	string str, tmpstr;
	cin>>n;cin.ignore();
	for(i=0;i<n;i++){
		getline(cin, str);
		y=0;
		tmpstr = str;
		while(true){
			tmpstr=str;
			while(true){
				y++;
				if(gcd(NUM, y) == 1){
					break;
				}
			}
			for(j=0;j<tmpstr.size();j++){
				if(tmpstr[j] != ' '){
					ay[j] = int(tmpstr[j] - 'a') * y;
				}else{
					ay[j] = -1;
				}
			}
			for(b=0;b<NUM;b++){
				for(j=0;j<tmpstr.size();j++){
					if(ay[j] == -1){
						tmpstr[j] = ' ';
					}else{
						tmpstr[j] = 'a' + ((ay[j] + b) % NUM);
					}
				}
				if(tmpstr.find("this") != string::npos)break;
				if(tmpstr.find("that") != string::npos)break;
				tmpstr = str;
			}
			if(b!=NUM)break;
		}
		cout << tmpstr << endl;
	}
	return 0;
}