t=int(input())
for i in range(t):
g=int(input())
a='{:034b}'.format(g)
a=a[2:]
c=a[::-1]
print(int(c,2))
dD1pbnQoaW5wdXQoKSkKZm9yIGkgaW4gcmFuZ2UodCk6CglnPWludChpbnB1dCgpKQoJYT0nezowMzRifScuZm9ybWF0KGcpCglhPWFbMjpdCgljPWFbOjotMV0KCXByaW50KGludChjLDIpKQ==