#include<iostream>
#include<string>
#include<stdio.h>
#include<ctype.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string a;
	char b[500];
	for(int u=0;u<n;u++){
		cin.ignore();
		getline(cin,a);
		int c=0;
		bool end=false;
		while(true){
		for(int i=0;i<a.size();i++){
			if(isalpha(a[i])!=0)
			    b[i]=((a[i]-'a')*c)%26+'a';
			else
				b[i]=a[i];
		}
		int d=0;
		while(true){
			for(int i=0;i<a.size()-3;i++){
				if(b[i]=='t'&&b[i+1]=='h'&&((b[i+2]=='i'&&b[i+3]=='s')||(b[i+2]=='a'&&b[i+3]=='t'))){
					end=true;
					break;
				}
			}
			if(end==true)
				break;
			for(int i=0;i<a.size();i++){
				if(isalpha(b[i])!=0){
					b[i]++;
					if(b[i]>'z')
						b[i]='a';
				}
			}
			d++;
			if(d==100)
				break;
		}
		if(end==true)
			break;
		c++;
		}
		for(int i=0;i<a.size();i++)
			cout<<b[i];
		cout<<endl;
	}
	return 0;
}