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, "")
}

Python: string = 'abcdefghijklmnopqrstuvwxyz'
table = []
for i in string:
    table.append(i)

def encode(string,a,b):
    data = list(string)
    s = []
    flag = 0
    for c in data:
        try:
            i = table.index(c)
            tmp = (a*i+b)%26
            s[-1:] += table[tmp]
        except:
            s.append(' ')
    s = ''.join(s)
    return s

n = int(input())
for x in range(n):
    code = str(input())
    for a in range(1,26):
        for b in range(1,26):
            s = encode(code,a,b)
            if 'that' in s:
                print(s)
                break
            elif 'this' in s:
                print(s)
                break

Python: z='abcdefghijklmnopqrstuvwxyz'
for _ in[0]*int(input()):
 e=input()
 for i in range(1,26,2):
  for j in range(26):
   a=''
   for c in e:
    if c in z:a+=z[(z.index(c)*i+j)%26]
    else:a+=c
   if'that'in a or'this'in a:print(a);break

Python: def F(alpha, beta, c):
    gamma = ord(c) - ord("a")
    return chr((alpha*gamma + beta) % 26 + ord("a"))

alphalist = [1,3,5,7,9,11,15,17,19,21,23,25]
N = int(input())
for lines in range(N):
    S = input()
    words = S.split()
    keyA = -1
    keyB = -1
    for i in range(len(words)):
        if len(words[i]) == 4:
            w = words[i]
            for k in range(len(alphalist)):
                for l in range(26):
                    alpha = alphalist[k]
                    beta = l
                    if F(alpha,beta,w[0]) == "t" and F(alpha,beta,w[1]) == "h":
                        if F(alpha,beta,w[2]) == "a" and F(alpha,beta,w[3]) == "t":
                            keyA = alpha
                            keyB = beta
                        elif F(alpha,beta,w[2]) == "i" and F(alpha,beta,w[3]) == "s":
                            keyA = alpha
                            keyB = beta
                    if keyA > 0:
                        break
                if keyB > 0:
                    break
        if keyA > 0:
            break

    for i in range(len(S)):
        if S[i] == " ":
            print(" ", end="")
        else:
            print(F(keyA,keyB,S[i]), end="")
    print("")

Python: # -*- coding: utf-8 -*-

import sys
import os
import math

N = int(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'

def encode(s, alpha, beta):
    t = []
    for c in s:
        if c == ' ':
            t.append(c)
        else:
            gamma = ord(c) - 97
            v = (alpha * gamma + beta) % 26
            w = alphabet[v]
            t.append(w)
    return ''.join(t)


for i in range(N):
    s = input().strip()
    
    for a in range(0, 26):
        for b in range(0, 26):
            encoded_this = encode('this', a, b)
            encoded_that = encode('that', a, b)
            if encoded_this in s or encoded_that in s:
                encoded_alphabet = encode(alphabet, a, b)
                table = str.maketrans(encoded_alphabet, alphabet)
                dst = s.translate(table)
                print(dst)

Python: string = 'abcdefghijklmnopqrstuvwxyz'
table = []
for i in string:
    table.append(i)

def encode(string,a,b):
    data = list(string)
    s = []
    flag = 0
    for c in data:
        try:
            i = table.index(c)
            tmp = (a*i+b)%26
            s[-1:] += table[tmp]
        except:
            s.append(' ')
    s = ''.join(s)
    return s

n = int(input())
for x in range(n):
    code = str(input())
    for a in range(26):
        for b in range(26):
            s = encode(code,a,b)
            if 'that' in s:
                print(s)
                break
            elif 'this' in s:
                print(s)
                break

Python: for _ in range(int(input())):
    s=input()
    for i in range(1,27,2):
        for j in range(27):
            a=[]
            for k in range(len(s)):
                if s[k].islower():a+=chr(((ord(s[k])-97)*i+j)%26+97)
                else:a+=s[k]
            a=''.join(a)
            if 'this' in a or 'that' in a:print(a);break

Python: z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in range(1,26,2):
  for j in range(26):
   if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
for _ in[0]*int(input()):
 s=input()
 a=''.join(e(c,*f())for c in z)
 t=str.maketrans(a,z)
 print(s.translate(t))

Python: for _ in[0]*int(input()):
 e=input()
 for i in range(26):
  for j in range(26):
   a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
   if'that'in a or'this'in a:print(a);break

Python: for _ in[0]*int(input()):
 e=input()
 for i in range(26):
  for j in range(26):
   a=''.join([c,chr(((ord(c)-97)*i+j)%26+97)][c.islower()]for c in e)
   if('that'or'this')in a:print(a);break

Python: string = 'abcdefghijklmnopqrstuvwxyz'
table = []
for i in string:
    table.append(i)

def encode(string,a,b):
    data = list(string)
    s = []
    flag = 0
    for c in data:
        try:
            i = table.index(c)
            tmp = (a*i+b)%26
            s[-1:] += table[tmp]
        except:
            s.append(' ')
    s = ''.join(s)
    return s

n = int(input())
for i in range(n):
    code = str(input())
    for a in range(1,26):
        for b in range(1,26):
            s = encode(code,a,b)
            if 'that' in s:
                print(s)
            elif 'this' in s:
                print(s)

Python: z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in range(1,26,2):
  for j in range(26):
   if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
for _ in[0]*int(input()):
 s=input()
 k=f()
 print(s.translate(str.maketrans(''.join(e(c,*k)for c in z),z)))

Python: from itertools import product

for _ in [0]*int(input()):
    a = [ord(c)-97 for c in input()]

    for p1, p2 in product(range(3, 10000, 2), range(26)):
        text = ""
        for code in a:
            if code == -65:
                text += " "
                continue
            for x in range(26):
                if (p1*x+p2)%26 == code:
                    text += chr(x+97)
                    break

        if "that" in text or "this" in text:
            print(text)
            break