var abc="abcdefghijklmnopqrstuvwxyz".split("");

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var n=Arr.shift()-0;
for(var I=0;I<n;I++){
   var str=Arr[I];
   [1,3,5,7,9,11,15,17,19,21,23,25].forEach(function(A){
      for(var B=0;B<26;B++){
         var STR="";
         for(var i=0;i<str.length;i++){
            var index=abc.indexOf(str[i]);
            STR+=(index!=-1)?abc[(A*(index+B))%26]:" ";
         }
         if(STR.match(/this|that/))return console.log(STR);
      }
   });
}