In the year 1992 AD, little Pranoti started to learn how to write. She already figured out that her left hand is far stronger than her right. So she continued the subtle art of writing with her left hand. Unfortunately, no other friends of her used left arm for writing. Poor Pranoti observed that all the right-handers including her teacher, starts writing from the left and continues to the right. For example, if they want to write the phrase, “Keep the faith”, first they write, ‘K’, then they put ‘e’ to the right of it, and so on. Pranoti thought she should also do the same thing, but with left hand! So she would start from right, write the first letter, and write the next one to it’s left. So she would write the same phrase above like ‘htiaf eht peeK’. But clearly, she was “doing it wrong”. Her teacher eventually found out this innocent mistake in her writing and fixed her. Even today, she uses her left arm for writing, but now everything is just alright!

But who can forget those good old days! Pranoti preserved all of her notebooks in her shelf, and that’s where our problem has begun! One day, Pranoti’s close friend Jaami went to her house and found out those notebooks once used by his beloved friend. He took those notes out and found out those funny writings. But since it was a math notebook, all that are written in that book are numbers. And quite naturally, those numbers are written in the wrong order.

Now given a number written by Pranoti, you need to find out the original number that she intended to write.

Input

The input starts with the number of test cases T (T ≤ 50). For each test case, a number x will be written, one number in a line by itself. This number indicates the number written by Pranoti in her early days.

Output

Print a line for each test case, the actual number that Pranoti wanted to write. It is guaranteed that every output number will be from 0 to 1000000000 and there will not be any leading zeros written in the original number.