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: import sys
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)
input()
for s in sys.stdin:
 s=s.strip()
 k=f()
 print(s.translate(str.maketrans(''.join(e(c,*k)for c in z),z)))

Python: import sys
readline = sys.stdin.readline
write = sys.stdout.write
def convert(s, a, b):
    res = []
    ca = ord('a')
    for c in s:
        if c == ' ':
            res.append(" ")
        else:
            res.append(chr((((ord(c) - ca)*a + b) % 26) + ca))
    return "".join(res)

def solve():
    s = readline().strip()
    for a in range(26):
        for b in range(26):
            s1 = convert(s, a, b)
            if "that" in s1 or "this" in s1:
                write(s1)
                write("\n")
T = int(readline())
for i in range(T):
    solve()

Python: z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in(1,3,5,7,9,11,15,17,19,21,23,25):
  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)
def g(x,y,s=0,t=1):
 q,r=x//y,x%y
 return g(y,r,t,s-q*t) if r else t
for _ in[0]*int(input()):
 s=input()
 a,b=f()
 h=g(26,a)
 print(''.join(z[h*(z.index(c)-b)%26]if c in z else c for c in s))

Python: # Edit : 2014/11/16
# Lang : Python3
# Time : 00.  s
# judge: not Accepted

# File: pc0021.py

from itertools import product


if __name__ == "__main__":

    mycode0 = "abcdefghijklmnopqrstuvwxyz"
    mycode1 = {
        "a": 0,
        "b": 1,
        "c": 2,
        "d": 3,
        "e": 4,
        "f": 5,
        "g": 6,
        "h": 7,
        "i": 8,
        "j": 9,
        "k": 10,
        "l": 11,
        "m": 12,
        "n": 13,
        "o": 14,
        "p": 15,
        "q": 16,
        "r": 17,
        "s": 18,
        "t": 19,
        "u": 20,
        "v": 21,
        "w": 22,
        "x": 23,
        "y": 24,
        "z": 25,
    }

    nset = int(input())
    # nset = 1



    for i in range(0, nset):

        inl = ""
        outl = ""

        inl = input()

        for a, b in product(range(1, 26, 2), range(1, 26)):
            outl = ""
            if a == 13:
                continue
            #print(a, b)

            for i in range(0, len(inl)):
                if inl[i] == " ":
                    #print(" ")
                    outl += " "
                else:
                    #print(inl[i], mycode1[inl[i]], mycode0[mycode1[inl[i]]])
                    decode = (a * mycode1[inl[i]] + b) % 26
                    #print(mycode0[decode])
                    #outl[i] = mycode0[decode]
                    outl += mycode0[decode]
            if "this" in outl or "that" in outl :
                    print(outl)

                    #

Python: base = ord("a")

def restore(s):
  
  for a in [i for i in range(3, 26, 2) if i % 13]:
    for b in range(26):
      new = "".join([chr((a * (ord(x) - base) + b) % 26 + base) if x != " " else " " for x in s])
      if "that" in new or "this" in new:
        return new

n = int(input())

for _ in range(n):
  print(restore(input()))

Python: def affine(word, alpha, beta):
    word = list(word)
    for i in range(len(word)):
        word[i] = albs[(albs.index(word[i]) * alpha + beta) % 26]
    return ''.join(word)
albs = 'abcdefghijklmnopqrstuvwxyz'
alphas = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]
betas = list(range(26))
for _ in range(int(input())):
    words = input().split(' ')
    for alpha in alphas:
        for beta in betas:
            words = list(map(lambda x: affine(x, alpha, beta), words))
            if 'that' in words or 'this' in words:
                print(*words)
                break
        else:
            continue
        break

Python: base = ord("a")
alst = [i for i in range(3, 26, 2) if i % 13]
def restore(s):
  for a in range(1,26):
    for b in range(26):
      new = "".join([chr((a * (ord(x) - base) + b) % 26 + base) if x != " " else " " for x in s])
      if "that" in new or "this" in new:
        return new

n = int(input())

for _ in range(n):
  print(restore(input()))

Python: z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
 for i in(1,3,5,7,9,11,15,17,19,21,23,25):
  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)
def g(x,y,s=0,t=1):
 q,r=x//y,x%y
 return g(y,r,t,s-q*t) if r else t
for _ in[0]*int(input()):
 s=input()
 a,b=f()
 h=g(26,a)
 print(''.join(z[h*(z.index(c)-b)%26]if c in z else c for c in s))

Python: for n in range(int(input())) :
    s=input()
    for i in range(1,26):
        for j in range(27):
            a=[]
            for k in range(len(s)):
                if s[k].islower():#小文字か判別
                    a+=chr(((ord(s[k])-ord("a"))*i+j)%26+ord("a"))#文字の変換
                else:
                    a+=s[k]
            a="".join(a)
            #print(a)
            if "this" in a or "that" in a:
                print(a)
                break

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(26):
        for b in range(26):
            encoded = encode(s, a, b)
            if 'that' in encoded or 'this' in encoded:
                print(encoded)

Python: def affine(word, alpha, beta):
    word = list(word)
    for i in range(len(word)):
        word[i] = albs[(albs.index(word[i]) * alpha + beta) % 26]
    return ''.join(word)
albs = 'abcdefghijklmnopqrstuvwxyz'
alphas = [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]
betas = list(range(26))
for _ in range(int(input())):
    words = input().split(' ')
    for alpha in alphas:
        for beta in betas:
            words = list(map(lambda x: affine(x, alpha, beta), words))
            if 'that' in words or 'this' in words:
                print(*words)
                break
        else:
            continue
        break

Python: for _ in[0]*int(input()):
 e=input()
 for i in range(1,26,2):
  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: import sys
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)
input()
for s in sys.stdin:
 s=s.strip()
 k=f()
 print(s.translate(str.maketrans(''.join(e(c,*k)for c in z),z)))