#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long int t,i,temp,ans;
int z,x,p=0;
cin>>t;
temp=t;
while(temp!=0)
{
temp=temp/10;
p++;
}
long int n[p];
for(i=0;i<t;i++)
{
cin>>n[i];
}
if(t<=100000)
{
for(i=0;i<t;i++)
{ if(n[i]<=1000000000)
{x=int(log10(n[i])/log10(2));
ans=pow(2.0,x);
cout<<ans<<endl;
}
else
break;}
}
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNtYXRoPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKQp7CiAgICBsb25nIGludCB0LGksdGVtcCxhbnM7CiAgICBpbnQgeix4LHA9MDsKICAgIGNpbj4+dDsKdGVtcD10OwogICAgIHdoaWxlKHRlbXAhPTApCiAgICB7CgogICAgICAgICAgICAgICB0ZW1wPXRlbXAvMTA7CiAgICAgICAgICAgICAgIHArKzsKfQoKICAgIGxvbmcgaW50IG5bcF07CmZvcihpPTA7aTx0O2krKykKewogICAgICAgICAgICAgICAgY2luPj5uW2ldOwp9ICAgICAgICAgICAgICAgIAppZih0PD0xMDAwMDApCgp7ICAgIAogICAgZm9yKGk9MDtpPHQ7aSsrKQogICAgeyBpZihuW2ldPD0xMDAwMDAwMDAwKQogICAge3g9aW50KGxvZzEwKG5baV0pL2xvZzEwKDIpKTsKICBhbnM9cG93KDIuMCx4KTsKICAgICBjb3V0PDxhbnM8PGVuZGw7CiAgICAgIH0KICAgICAgZWxzZQogICAgICBicmVhazt9Cn0gICAgCnJldHVybiAwOwp9