#D502. Affine Cipher
Affine Cipher
Affine Cipher
One of the simple ciphers is the affine cipher. First, replace the letters a to z with the numbers a = 0, b = 1, c = 2, ..., x = 23, y = 24, z = 25 and 0 to 25. Then replace the original alphabet with the following formula.
mod
However, mod 26 represents the remainder after dividing by 26. For example, when , the alphabet'a'(= 0) is mod and'c In', the alphabet'n'(= 13) is replaced with'p' at mod . At this time, it is assumed that and are carefully selected so that is always associated with on a one-to-one basis ( and 26 are relatively prime). , as in , and'a'and'n' are the same'h' It will not be replaced by. Also, non-alphabetic characters are not replaced.
Create a program that outputs the encrypted character string decrypted into the original text. In the original text, as a keyword
that this
It is assumed that one of the above is always included.
Input
Given multiple datasets. The first line gives the number of datasets (). It is followed by rows of data. Each dataset is given an encrypted sentence of up to 256 characters consisting of lowercase letters and blanks on one line.
Output
For each dataset, output the decrypted original text on one line.
Example
Input
1 y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
Output
i submit that there is another point of view
inputFormat
outputFormat
outputs the encrypted character string decrypted into the original text. In the original text, as a keyword
that this
It is assumed that one of the above is always included.
Input
Given multiple datasets. The first line gives the number of datasets (). It is followed by rows of data. Each dataset is given an encrypted sentence of up to 256 characters consisting of lowercase letters and blanks on one line.
Output
For each dataset, output the decrypted original text on one line.
Example
Input
1 y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
Output
i submit that there is another point of view
样例
1
y eazqyp pnop pngtg ye obmpngt xmybp mr lygw
i submit that there is another point of view