Seonyeong wrote a love letter to her boyfriend. To keep others from reading it, she encrypts the letter as follows.
Seonyeong never uses spaces, so the length of the letter is always a perfect square.
For example, if the original letter is RosesAreRedVioletsAreBlue (length 25, i.e. a 5×5 square), the encrypted letter becomes eedARBtVrolsiesuAoReerles.
Given an encrypted letter, write a program that restores the original letter.
The first line contains the number of test cases $T$. $T$ is at most $100$.
Each of the next $T$ lines contains one encrypted letter. Each letter consists only of uppercase and lowercase English letters, and its length is at least $1$, at most $10000$, and always a perfect square.
For each test case, print the restored original letter on its own line.