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<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['t'],mp[vec[flg[i]][3]]);
					check[3]=func(a,b,mp['i'],mp[vec[flg[i]][2]]) || func(a,b,mp['s'],mp[vec[flg[i]][3]]);
					if(check[0] && check[1] && ((check[2])||(check[3]))){
						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;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }

/// WA ?????????????????´????????????
/**
 * in
2
y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
y eazqyp pnop pngtg ye obmpngt xmybp mr lygw y eazqyp pnop pngtg ye obmpngt xmybp mr lygw

 *out
i submit that there is another point of view
i submit that there is another point of view i submit that there is another point of view       @
 
**/
int main(){
    int mod=1000000007;
    int n,len,x,y;
    char s[260];
    scanf("%d",&n);
    while (fgets(s,260,stdin)!=NULL) {
        len=strlen(s)-1;
        bool flg=0;
        for (int a=0;a<26;++a) {
            if (gcd(a,26)!=1) continue;
            for (int b=0;b<26;++b) {
                char chk[len];
                for (int c=0;c<len;++c) {
                    if (islower(s[c])) {
                        chk[c]=(((s[c]-'a')*a+b)%26)+'a';
                    }
                }
                for (int d=0;d<len;++d) {
                    if (!strncmp(&chk[d],"this",4) || !strncmp(&chk[d],"that",4)) {
                        x=a;
                        y=b;
                        flg=1;
                    }
                }
            }
        }
        char ans[len];
        if (flg && len>3) {
            for (int i=0;i<len;++i) {
                if (islower(s[i])) {
                    printf("%c",((s[i]-'a')*x+y)%26+'a');
                } else {
                    printf("%c",s[i]);
                }
            }
            printf("\n");

        //for (int i=0;i<len;++i) {
            //if (islower(s[i])) ans[i]=(((s[i]-'a')*x+y)%26+'a');
            //else ans[i]=s[i];
            //printf("%c",s[i]);
        }
        //if (flg && len>3) printf("%s\n",ans);
        //printf("%d,%d\n",len,strlen(ans));
        flg=0;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	int a[] = {1,3,5,7,9,11,15,17,19,21,23,25};
	cin >>n;
	cin.ignore();
	while(n--){
		string word;
		getline(cin,word);
		for(int i=0; i<12; i++){
			for(int j=0; j<26; j++){
				string affine = word;
				for(int k=0; k<(int)word.size(); k++){
					if(affine[k]>='a' && affine[k]<='z'){affine[k] = (a[i]*(affine[k]-'a')+j)%26+'a';}
				}
				if(affine.find("this")+1 || affine.find("that")+1){
					cout<<affine<<endl;
					goto label;
				}
			}
		}
		label:;
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
char c[257];
char d[257];
bool use[26];
int main(){
	int a;
	scanf("%d ",&a);
	while(a--){
		cin.getline(c,257);
		int t=strlen(c);
		for(int i=0;i<26;i++){
			for(int j=0;j<26;j++){
				bool ok=false;
				for(int k=0;k<26;k++)use[k]=false;
				for(int k=0;k<26;k++){
					if(use[(i*k+j)%26])goto dame;
					else use[(i*k+j)%26]=true;
				}
				for(int k=0;k<t;k++){
					if(c[k]<='z'&&c[k]>='a'){
						d[k]=(i*(c[k]-'a')+j)%26+'a';
					}else{
						d[k]=c[k];
					}
				}
				for(int k=0;k<t-3;k++){
					if(d[k]=='t'&&d[k+1]=='h'){
						if(d[k+2]=='a'&&d[k+3]=='t')ok=true;
						if(d[k+2]=='i'&&d[k+3]=='s')ok=true;
					}
				}
				if(ok){
					printf("%s\n",d);
				}
				dame:;
			}
		}
	}
}