Go: package main

import (
	"bufio"
	"os"
	"fmt"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		s := scanner.Text()
		rs := []rune(s)
		flag := false
		for b := 0; b <= 26; b++ {
			for a := 0; a <= 26; a++ {
				ans := rs
				if a%2 != 0 && a%13 != 0 {
					for j := 0; j < len(ans); j++ {
						if ans[j] >= 'a' && ans[j] <= 'z' {
							ans[j] = 'a' + ('a'*(ans[j]-'a')+'b')%26
						}
					}
					sans := runeSlice2String(ans)
					if strings.Contains(sans, "that") || strings.Contains(sans, "this") {
						fmt.Println(sans)
						flag = true
						break
					}
				}
			}
			if flag {
				break
			}
		}
	}
}

func runeSlice2String(input []rune) string {
	tmp := make([]string, len(input))
	for i := 0; i < len(input); i++ {
		tmp[i] = string(input[i])
	}
	return strings.Join(tmp, "")
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

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

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;

int n;
vector<string> s;
vector<string> st;
string t;
vector<int> a;
vector<int> b;
int al,be;
int alpha=-1,beta=-1;

int afin(char s,int u,int t);

int gcd(int x,int y){
	if(y==0) return x;
	return gcd(y,x%y);
}
void atis(string st,int al,int be){
	if(afin(st[2],al,be)==0&&afin(st[3],al,be)==19){
		alpha=al;
		beta=be;
		//cout<<alpha<<" "<<beta<<endl;
	}
	if(afin(st[2],al,be)==8&&afin(st[3],al,be)==18){
		alpha=al;
		beta=be;
		//cout<<alpha<<" "<<beta<<endl;
	}
}

bool th(string st){
	int al,be;
	rep(i,a.size()){
		rep(j,b.size()){
			if(afin(st[0],a[i],b[j])==19&&afin(st[1],a[i],b[j])==7){
				al=a[i];
				be=b[j];
				atis(st,al,be);
				//cout<<al<<" "<<be<<endl;
			}
		}
	}
}
//abcdefghijklmnopqrstuvwxyz
//012345678901234567890123456
			


int afin(char s,int u,int t){
	int c=s-'a';
	//cout<<s<<" "<<c<<endl;
	return (u*c+t)%26;
}

int main(){
	cin>>n;
	//string thth="thth";
	//printf("%d %d\n",thth[0],thth[1]);
	rep(i,500){
		if(gcd(i+1,26)==1){
			a.push_back(i+1);
			//cout<<i+1<<endl;
		}
	}
	rep(i,26) b.push_back(i);
	rep(k,n){
		s.clear();
		st.clear();
		
		
		int i=0;
		char tmp[300]={0};
		string tm;
		string tt;
		char tmtm;
		gets(tmp);
		//cout<<1<<" "<<tmp<<endl;
		gets(tmp);
		//cout<<2<<" "<<tmp<<endl;
		//cout<<tmp<<endl;
		rep(i,300){
			if(tmp[i]=='\n'){
				s.push_back(tm);
				//cout<<tm<<endl;
				break;
			}
			else if(tmp[i]==' '){
				s.push_back(tm);
				//cout<<tm<<endl;
				tm.clear();
			}
			else{
				tt=tmp[i];
				tm+=tt;
			}
		}
		
		//gets(tmp);
		//cout<<3<<" "<<tmp<<endl;
		
		//cout<<tmp;
		
		rep(i,s.size()){
			if(s[i].size()==4){
				st.push_back(s[i]);
				//cout<<s[i]<<endl;
			}
		}
		rep(i,st.size()){
			th(st[i]);
			//if(alpa>0) cout<<"alpa="<<alpa<<" beta="<<beta<<endl;
		}
		
		rep(i,s.size()){
			rep(j,s[i].size()){
				printf("%c",afin(s[i][j],alpha,beta)+'a');
			}
			
			if(i!=s.size()-1)	cout<<" ";
			else cout<<endl;
		}
		s.clear();
		//cout<<"hoge"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    string thth[2]={"this","that"};
    string ths[2][26][26];
    for(int i=0;i<2;i++){
        for(int ia=0;ia<26;ia++){
            for(int ib=0;ib<26;ib++){
                ths[i][ia][ib]="    ";
            }
        }
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<2;j++){
            thth[j][i]-='a';
        }
    }
    for(int ia=0;ia<26;ia++){
        for(int ib=0;ib<26;ib++){
            for(int j=0;j<4;j++){
                for(int k=0;k<2;k++){
                    ths[k][ia][ib][j]=(thth[k][j]*ia+ib)%26;
                }
            }
        }
    }
    int aa=0,bb=0;
    for(int ii=0;ii<n;ii++){
        vector<string> strs;
        string ins;
        while(cin>>ins){
            strs.push_back(ins);
        }
        for(int i=0;i<strs.size();i++){
            for(int j=0;j<strs[i].size();j++){
                strs[i][j]-='a';
            }
        }
        for(int i=0;i<strs.size();i++){
            if(strs[i].size()==4){
                for(int ia=0;ia<26;ia++){
                    for(int ib=0;ib<26;ib++){
                        for(int j=0;j<2;j++){
                            if(strs[i]==ths[j][ia][ib]){
                                aa=ia;
                                bb=ib;
                                goto TO;
                            }
                        }
                    }
                }
            }
        }
TO:
        char cry[26];
        for(int i=0;i<26;i++){
            cry[(i*aa+bb)%26]=i;
        }
        for(int i=0;i<strs.size();i++){
            for(int j=0;j<strs[i].size();j++){
                strs[i][j]=cry[strs[i][j]]+'a';
            }
        }
        for(int i=0;i<strs.size()-1;i++){
            cout<<strs[i]<<' ';
        }
        cout<<strs[strs.size()-1]<<endl;
    }
}

C++: #include <iostream>
#include <string>
using namespace std;

string decode(string s) {
	for (int a=1; a<26; ++a) {
		for (int b=0; b<26; ++b) {
			string t = "";
			for (int i=0; i<(int)s.size(); ++i) {
				if (s[i] == ' ') {
					t += ' ';
				} else {
					t += char('a' + (a * (s[i] - 'a' + b)) % 26);
				}
			}
			if (t.find("this") != string::npos || t.find("that") != string::npos) {
				return t;
			}
		}
	}
}

int main() {
	int n;
	cin >> n;
	cin.ignore();
	string s;
	while (n--) {
		getline(cin, s);
		cout << decode(s) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

#define rep(a, b, i) for(int i = a; i < b; i++)

char ch(int a, int b, int c) {
	return (a * (c - 'a') + b) % 26 + 'a';
}

int main() {
	int n, a, b, c;
	cin >> n;
	cin.ignore();

	string str, res = "";
	for (; n > 0; n--) {
		getline(cin, str);

		rep(1, 26, a) {
			if (a == 2 || a == 13) continue;
			rep(1, 26, b) {
				res = str;
				c = 0;
				rep(0, str.size(), c) {
					if (res[c] == ' ') continue;

					res[c] = ch(a, b, res[c]);
				}
				if (res.find("this") != -1 || res.find("that") != -1) {
					cout << res << endl;
					a = 114514;
					b = 114514;
				}
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<map>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

bool func(int a,int b,int y,int fy){
	return fy==(a*y+b)%26;
}

int func(int a,int b,int y){
	return (a*y+b)%26;
}

map<char,int> mp;
map<int,char> rever;

int main(){
	rep(i,26){
		int ch=(int)'a';
		mp[(char)(ch+i)]=i;
		rever[i]=(char)(ch+i);
	}
	long long n;
	cin>>n;
	rep(l,n){
		string s,temp="";
		if(l==0)cin.ignore();
		getline(cin,s);
		vector<string> vec;
		vector<int> flg;
		rep(i,s.size()+1){
			if(s[i]==' ' || i==s.size()){
				if(temp.size()==4)flg.push_back(vec.size());
				vec.push_back(temp);
				temp="";
			}else{
				temp+=s[i];
			}
		}
		int alpha,beta;
		rep(i,flg.size()){
			alpha=beta=-1;
			rep(a,27){
				rep(b,27){
					bool check[3];
					check[0]=func(a,b,mp['t'],mp[vec[flg[i]][0]]);
					check[1]=func(a,b,mp['h'],mp[vec[flg[i]][1]]);
					check[2]=func(a,b,mp['a'],mp[vec[flg[i]][2]]) || func(a,b,mp['i'],mp[vec[flg[i]][2]]);
					if(check[0] && check[1] && check[2]){
						alpha=a;
						beta=b;
						break;
					}
				}
				if(alpha!=-1 || beta!=-1)break;
			}
			if(alpha!=-1 || beta!=-1)break;
		}
		string ans="";
		int alt;
		rep(i,vec.size()){
			rep(j,vec[i].size()){
				alt=mp[vec[i][j]];
				rep(i,26){
					if(func(alpha,beta,i)==alt){
						alt=i;
						break;
					}
				}
				ans+=rever[alt];
			}
			if(i!=vec.size()-1)ans+=" ";
		}
		cout<<ans<<endl;
	}
	return 0;
}