Bob Reads Alice's Binary Note Backwards
Alice likes to pass Bob notes in class, and every note holds a single positive integer written in binary, with no leading zeros. Bob, as usual, reads every note from right to left. So when Alice writes 6, the note says 110, Bob reads 011, and he thinks Alice meant 3. Sometimes they are lucky and Bob reads exactly the number Alice wrote.
Formally, for a positive integer n, write n in binary without leading zeros, reverse the string of bits, and read the result as a binary number (zeros that end up at the front after reversing are simply ignored). Call that value r(n). For each note, find r(n) and tell whether r(n) = n.
Input
The first line contains an integer q (1 ≤ q ≤ 10^5), the number of notes.
Each of the next q lines contains one integer n (1 ≤ n ≤ 10^18).
Output
For each note, print one line with the number Bob reads, r(n), followed by a space and YES if r(n) = n, or NO otherwise.
Notes
In the first example: 6 = 110 is read as 011 = 3. 5 = 101 reads the same both ways, and so does 1. 8 = 1000 is read as 0001 = 1. 11 = 1011 is read as 1101 = 13. 9 = 1001 reads the same both ways.
Numbers up to 10^18 do not fit in a 32-bit integer, so use a 64-bit type. r(n) never has more bits than n, so it fits too.