John Adam is a Computer Science student. His teacher gave him a homework to find a number that can be considered a binary palindrome. A number is considered a binary palindrome if it's binary representation is a palindrome. Also, the binary representation of the number must not contain any leading zeroes. Since John is poor at building logics, help John find the Nth binary palindrome if his teacher gave him N.
Input Format:
First line contain number of test cases T.
The following T lines consist of an integer N.
Output Format:
Print Nth binary palindrome.
Input Constraints:
1≤T≤106
1≤N≤109
The 1st magical number is 1, because its binary representation is "1".
The 2nd magical number is 3, because its binary representation is "11".
The integer 2 is not a magical number because its binary representation is "10", which is not a palindrome.