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<map>
using namespace std;
map<int,int>M;
string s;
string t[]={"that","this"};
main()
{
	int n;cin>>n;cin.ignore();
	for(;n--;)
	{
		getline(cin,s);
		bool f=0;
		for(int a=1;!f&&a<26;a++)for(int b=0;!f&&b<26;b++)
		{
			map<int,int>M;
			for(int z=0;z<26;z++)M[(a*z+b)%26]=z+1;
			string S="";
			for(int i=0;i<s.size();i++)S+=(s[i]>='a'&&s[i]<='z'?M[s[i]-'a']+'a'-1:s[i]);
			for(int i=0;!f&&i<2;i++)
			{
				for(int j=0;!f&&j+t[i].size()<S.size();j++)
				{
					if(S.substr(j,t[i].size())==t[i])
					{
						cout<<S<<endl;
						f=1;
					}
				}
			}
		}
	}
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <map>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;

int main() {
    string y;
    
    int z[12]={1,3,5,7,9,11,15,17,19,21,23,25};
    
    int affine[12*26][26]={0};
    for(int a=0; a<12; a++){
        for(int b=0; b<26; b++){
            for(int i=0; i<26; i++){
                    affine[a*26+b][(i*z[a]+b)%26]=i;
            }
        }
    }
    
    int temp;
    scanf("%d",&temp);
    
    
    
    
    while(getline(cin,y)){
        string x=y;
        
        
        for(int j=0; j<12*26; j++){
            if(x.find("this")!=-1 || x.find("that")!=-1){
                cout<<x<<endl;
                break;
            }
            for(int i=0; i<(int)y.length(); i++){
                if(y[i]==' '){
                    
                }else{
                    x[i]=affine[j][y[i]-'a']+'a';
                }
            }
        }
        
        
        
    }
    
    
    
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main(){
	int n;
	cin >> n;
	cin.ignore();
	while(n-->0){
		string s;
		getline(cin,s);
		int ans;
		for(int i=1;i<26;i++){
		for(int k=0;k<26;k++){
			string w = s;
			for(int j=0;j<s.size();j++) if(w[j]!=' ') w[j] = ((w[j]-'a')*i+k)%26+'a';
			istringstream is(w);
			string t;
			bool a = false;
			while(is >> t){ if(t=="that" or t=="this"){ a = true; break; } }
			if(a) s = w;
			if(a) break;
		}}
		cout << s << endl;
	}
}

C++: #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c) 

int main()
{
	int i,j,k,l,z;
	int n=0;
	char str[257]={};
	char str1[257][257]={};
	char str2[257][257]={};
	char *p;
	int ans,count=1;
	int flag=0;
	int len=0;
	scanf("%d\n",&n);

	rep(z,n)
	{
		fgets(str,sizeof(str),stdin);
		str[strlen(str)-1]='\0';
		i=0;
		j=0;
		k=0;
		rep(i,strlen(str))
		{
			if(str[i]==' ')
			{
				j++;
				k=0;
				i++;
				count++;
			}
			str1[j][k]=str[i];
			k++;
		}
		rep(k,count)
		{
			if(strstr(str1[k],"that")!=NULL)flag=2;
			else if(strstr(str1[k],"this")!=NULL)flag=2;
		}
		if(flag!=2)
		{
			while(1)
			{
				rep_to(1,j,1000)
				{
					rep(k,count)
					{
						if(strstr(str2[k],"that")!=NULL)flag=1;
						else if(strstr(str2[k],"this")!=NULL)flag=1;
					}
					if(flag==1)break;
					rep(k,count)
					{
						rep(l,strlen(str1[k]))
						{
							str2[k][l]=(i*(str1[k][l]-97)+j)%26+97;
						}
					}
				}
				if(flag==1)break;
				i++;
			}
			rep(i,count)
			{
				rep(j,strlen(str2[i]))
				{
					if(len>=strlen(str))break;
					else 
					{
						printf("%c",str2[i][j]);
						len++;
					}
				}
				if(len>=strlen(str))break;
				else printf(" ");
				len++;
			}
			printf("\n");
		}
		else
		{
			rep(i,count)
			{
				if(count!=i)printf("%s ",str1[i]);
				else printf("%s",str1[i]);
			}
			printf("\n");
		}
		
		flag=0;
		rep(i,strlen(str))str[i]='\0';
		rep(i,count)rep(j,strlen(str2[i]))str2[i][j]='\0';
		rep(i,count)rep(j,strlen(str1[i]))str1[i][j]='\0';
		count=1;
		i=0;
		len=0;
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int alp[12] ={1,3,5,7,9,11,15,17,19,21,23,25};
int main()
{
  string str;
  string temp;
  int n;
  scanf("%d\n",&n);
  bool flag = false;
  for(int i = 0;i < n;i++){
    getline(cin,str);
    temp = str;
    if(!flag){
      for(int j = 0;j <12;j++){//α
	for(int k = 0; k <=26;k++){//β
	  if(!flag&&(temp.find("this") !=string::npos||temp.find("that")!=string::npos)){
	    cout <<temp<<endl;
	    flag = true;
	    break;
	  }
	  for(int l = 0;l <str.length();l++){
	    if(str[l] >= 'a' && str[l] <= 'z'){
	      temp[l] =((((str[l]-'a')*alp[j])+k)%26)+'a';
	    }
	  }
	}
      }
    }
  }
  return 0;
}