POLYBIUS - Polybius square

no tags 

For given text, encipher it with Polybius square and print.

Input

The first line of the standard input contains one integer t (t<10001) which is the number of test cases.

In each of the next t lines there is a string n (could contain spaces, which you dont have to encipher; apart from spaces it will be only made of big letters - 'A' to 'Z').

Output

For each test, print ciphered string n.

Score

Score is source length.

Example

Input:
4
SHORTENING IS FUNNY
NO IT ISNT
TRY IT AND ASCERTAIN
JI JI
Output: 43 23 34 42 44 15 33 24 33 22 24 43 21 45 33 33 54
33 34 24 44 24 43 33 44
44 42 54 24 44 11 33 14 11 43 13 15 42 44 11 24 33
24 24 24 24


hide comments
seyed_8610303: 2018-11-01 17:50:22

578 WITH KOTLIN :)

Mitch Schwartz: 2014-10-13 17:10:53

@Lieve Corssmit: Python 3.4 and PyPy do not work on Pyramid cluster.

I don't think you could have read that error from stderr from a SPOJ submission, so I expect you are making some mistake in your code or in the input you are using for testing.


Added by:Piotr KÄ…kol
Date:2010-01-11
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC VB.NET
Resource:POLYBIUS