#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)



int main(){
	
	string sss;
	getline(cin,sss);
	
	while(1){
		string a;
		getline(cin,a);
		if(cin.eof())break;
		
		reps(alpha,2,100){
			reps(beta,2,100){
				
				bool ok = true;
				map<int,int> visit;
				rep(j,26){
					int next = (j*alpha+beta)%26;
					if(visit[next]==0){
						visit[next]=1;
					}else{
						ok=false;
					}
				}
				if(!ok)continue;
				
				string b;
				rep(j,a.size()){
					if('a'<=a[j]&&a[j]<='z')b+=((a[j]-'a')*alpha+beta)%26+'a';
					else b+=a[j];
				}
				if(b.find("this")!=-1 || b.find("that")!=-1){
					cout<<b<<endl;
					goto A;
				}
			}
		}
		A:;
	}
}