#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(tt>=10000||t==1)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0,t1=0;
            long long h=r*(b+1);
            long long le=b,ri=b*2;
            while(ri<=h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                if(ri%r!=0)
                ans=(ri-kk)/r+1;
                else ans=(ri-kk)/r;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
                tt++;
                if(tt>=10000){
                        if(!t1)
                        {ri=h-(b*10000);le=ri-b;t1=1;tt=0;}
                        else if(tt>=10100)break;
                }
            }
            if(b/(b-r)>10000)cout<<"REBEL\n";
            else if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long t,r,b,k;
int main()
{
    cin>>t;
    while(t--)
    {
        cin>>r>>b>>k;if(r>b)swap(r,b);
        if(r==b){cout<<"OBEY\n";continue;}
        if(r*k<b){cout<<"REBEL\n";continue;}
        if(b%r==0)
        cout<<"OBEY\n";
        else
        {
            int tt=0;
            long long h=r*b;
            long long le=b,ri=b*2;//cout<<le<<"   "<<ri<<endl;
            while(ri<h)
            {
                long long kk=(le/r+1)*r;
                long long ans=0;
                if(ri-kk>=r)
                ans=(ri-kk)/r+1;
                if(ans>=k){tt=-1;cout<<"REBEL\n";break;}
                le=ri;
                ri+=b;
            }
            if(tt!=-1)cout<<"OBEY\n";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[155];
int b[155];
int arr[155];
signed main(){
	int _;cin>>_;
	while(_--){
		int n;
		cin>>n;
		if(n==0) {
			cout<<"1"<<'\n';
			continue;
		}
		if(n%2){
			cout<<n+1<<'\n';
		}else{
			cout<<n<<'\n';
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	//cout<<(1<<30);
	int _;cin>>_;

	while(_--){
		int n;
		cin>>n;
		if(n==2){
			cout<<"2"<<'\n';
			continue;
		}
		cout<<n+1<<'\n';
	}

	return 0;
}
/*
a-x=a^x

loool

*/


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
typedef long long ll;
const int N=0;
int n,k,x,t;
string s;
vector<int>v;
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
//	freopen("output.txt", "w" , stdout);
	#endif // ONLINE_JUDGE
	scanf("%d",&n);
	int cnt=0;
	for(int i =0;i<n;i++){
		scanf("%d",&x);
		while(x){
			x>>=1;
			if(x&1){
				cnt++;
			}
		}
		printf("%d\n",int(round(pow(2,cnt))) );
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
typedef long long ll;
const int N=0;
int n,k,x,t;
string s;
vector<int>v;
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
//	freopen("output.txt", "w" , stdout);
	#endif // ONLINE_JUDGE
	scanf("%d",&n);
	int cnt=0;
	for(int i =0;i<n;i++){
		scanf("%d",&x);
		while(x>>1){
			x>>=1;
			if(x&1){
				cnt++;
			}
		}
		printf("%d\n",int(pow(2,cnt)) );
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
typedef long long ll;
const int N=0;
int n,k,x,t;
string s;
vector<int>v;
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
//	freopen("output.txt", "w" , stdout);
	#endif // ONLINE_JUDGE
	scanf("%d",&n);
	for(int i =0;i<n;i++){
		scanf("%d",&x);
		int cnt=0;
		while(x){
			if(x&1){
				cnt++;
			}
			x>>=1;
		}
		printf("%d\n",int(pow(2,cnt)));
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(),c.end()
typedef long long ll;
const int N=0;
int n,k,x,t;
string s;
vector<int>v;
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
//	freopen("output.txt", "w" , stdout);
	#endif // ONLINE_JUDGE
	scanf("%d",&n);
	int cnt=0;
	for(int i =0;i<n;i++){
		scanf("%d",&x);
		while(x){
			x>>=1;
			if(x&1){
				cnt++;
			}
		}
		printf("%lld\n",ll(pow(2,cnt)) );
	}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
using namespace std;

ll n, i, t, z;

int main()
{
    cin >> t ;
    while(t > 0)
    {
        cin >> n;
        i = 1;
        z = 1;
        while(i < n)
        {
            z ++ ;
            i *= 2;
        }
        if(i == n)i = z ;
        cout << i << endl ;
    t -- ;
    }
    return false ;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
using namespace std;

ll n, i, t, z;

int main()
{
    cin >> t ;
    while(t > 0)
    {
        cin >> n;
        z = __builtin_popcount(n);
        cout << (1ll << z) << endl ;
        t -- ;
    }
    return false ;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
using namespace std;

ll n, i, t;

int main()
{
    cin >> t ;
    while(t > 0)
    {
        cin >> n;
        i = 1;
        while(i < n)
        {
            i *= 2;
        }
        cout << i << endl ;
    }
    return false ;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
using namespace std;

ll n, i, t, z;

int main()
{
    cin >> t ;
    while(t > 0)
    {
        cin >> n;
        i = 1;
        z = 0;
        while(i < n)
        {
            z ++ ;
            i *= 2;
        }
        if(i == n)i = z ;
        cout << i << endl ;
    t -- ;
    }
    return false ;
}


#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
using namespace std;

ll n, i, t;

int main()
{
    cin >> t ;
    while(t > 0)
    {
        cin >> n;
        i = 1;
        while(i < n)
        {
            i *= 2;
        }
        cout << i << endl ;
        t -- ;
    }
    return false ;
}


// питер паркер эй! люблю мэри джэйн)
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main(){
    rapgame
    read(t);
    while(t--){
        readll(n);
        lli ans=1,s=n,rap=1,steps=0;
        while(s>=rap){
            steps++;
            rap*=2;
        }
        steps--;
        fr(i,steps){
            if(n>=1<<(steps-i)){ ans*=2;n-=1<<(steps-i);}
        }
        if(ans==1) cout << "0\";
        else cout << ans<< '\n';
    }
    return 0;
}


// питер паркер эй! люблю мэри джэйн)
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main(){
    rapgame
    read(t);
    while(t--){
        readll(n);
        lli ans=1,s=n,rap=1,steps=0;
        while(s>=rap){
            steps++;
            rap*=2;
        }
        steps--;
        frbig(i,steps){
            if(n>=1<<(steps-i)){ ans*=2;n-=1<<(steps-i);}
        }
        if(ans==1) cout << "0\n";
        else cout << ans<< '\n';
    }
    return 0;
}


// питер паркер эй! люблю мэри джэйн)
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main(){
    rapgame
    read(t);
    while(t--){
        readll(n);
        lli ans=1,s=n,rap=1,steps=0;
        while(s>=rap){
            steps++;
            rap*=2;
        }
        frbig(i,steps){
            if(n>=1<<(steps-i-1)){ ans*=2;n-=1<<(steps-i-1);}
        }
        cout << ans << '\n';
    }
    return 0;
}


// питер паркер эй! люблю мэри джэйн)
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int main(){
    rapgame
    read(t);
    while(t--){
        readll(n);
        lli ans=1,s=n,rap=1,steps=0;
        while(s>=rap){
            steps++;
            rap*=2;
        }
        frbig(i,steps){
            if(n>=1<<(steps-i-1)){ ans*=2;n-=1<<(steps-i-1);}
        }
        if(ans==1) cout << "0\n";
        else cout << ans << '\n';
    }
    return 0;
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, a;

int main(){
	cin >> t;

	while (t--){
		cin >> a;
		if (a % 2 == 0){
			int h = a;
			while (h > 0 && h % 2 == 0)
				h /= 2;
			if (a == 0)
				cout << 1 << endl;
			else if (h == 1)
				cout << 2 << endl;
			else
				cout << 4 << endl;
		}
		else{
			int h = a, k = 1;
			int b = a + 1;
			while (b % 2 == 0)
				b /= 2;
			while (h > 0){
				k += (h % 2);
				h /= 2;
			}
			if (b == 1)
				cout << a + 1 << endl;
			else
				cout << k * 2 << endl;
		}
		//for (int i = 0; i <= a; i++)
		//	cout << a << " ^ " << i << " " << (a ^ i) << endl;
	}
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, x;

int main(){
	cin >> t;

	while (t--){
		cin >> x;
		int k = 0;
		while (x > 0){
			k += (x % 2);
			x /= 2;
		}
		cout << (1 << k) << endl;
	}
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, a;

int main(){
	cin >> t;

	while (t--){
		cin >> a;
		if (a % 2 == 0){
			if (a == 0)
				cout << 1 << endl;
			else if (a == 2)
				cout << 2 << endl;
			else
				cout << 4 << endl;
		}
		else{
			int h = a + 1;
			while (h % 2 == 0)
				h /= 2;
			if (h == 1)
				cout << a + 1 << endl;
			else
				cout << 4 << endl;
		}
		//for (int i = 0; i <= a; i++)
		//	cout << a << " ^ " << i << " " << (a ^ i) << endl;
	}
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, a;

int main(){
	cin >> t;

	while (t--){
		cin >> a;
		if (a % 2 == 0){
			int h = a;
			while (h > 0 && h % 2 == 0)
				h /= 2;
			if (a == 0)
				cout << 1 << endl;
			else if (h == 1)
				cout << 2 << endl;
			else
				cout << 4 << endl;
		}
		else{
			int h = a + 1;
			while (h % 2 == 0)
				h /= 2;
			if (h == 1)
				cout << a + 1 << endl;
			else
				cout << 4 << endl;
		}
		//for (int i = 0; i <= a; i++)
	//		cout << a << " ^ " << i << " " << (a ^ i) << endl;
	}
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, a;

int main(){
	cin >> t;

	while (t--){
		cin >> a;
		if (a % 2 == 0){
			int h = a;
			while (h % 2 == 0)
				h /= 2;
			if (a == 0)
				cout << 1 << endl;
			else if (h == 1)
				cout << 2 << endl;
			else
				cout << 4 << endl;
		}
		else{
			int h = a + 1;
			while (h % 2 == 0)
				h /= 2;
			if (h == 1)
				cout << a + 1 << endl;
			else
				cout << 4 << endl;
		}
		//for (int i = 0; i <= a; i++)
	//		cout << a << " ^ " << i << " " << (a ^ i) << endl;
	}
}


//by _Yezhik_
#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, n) for (int i = 1; i <= n; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return

const int inf = INT_MAX;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;

using namespace std;

int t, a;

int main(){
	cin >> t;

	while (t--){
		cin >> a;
		if (a % 2 == 0){
			int h = a;
			while (h > 0 && h % 2 == 0)
				h /= 2;
			if (a == 0)
				cout << 1 << endl;
			else if (h == 1)
				cout << 2 << endl;
			else
				cout << 4 << endl;
		}
		else{
			int h = a, k = 1;
			int b = a + 1;
			while (b % 2 == 0)
				b /= 2;
			while (h > 0){
				k += (h % 2);
				h /= 2;
			}
			if (b == 1)
				cout << a + 1 << endl;
			else
				cout << k * 2 << endl;
		}
		for (int i = 0; i <= a; i++)
			cout << a << " ^ " << i << " " << (a ^ i) << endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
//#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))

int main()
{
    ll t;
    cin>>t;
    while(t)
    {
        ll n,i=0;
        cin>>n;
        //cout<<"n1 "<<n<<endl;
        while(n>0)
        {
            //cout<<"n "<<n<<endl;
            n=n&(n-1);
            //cout<<"n "<<n<<endl;
            i++;
        }
        //cout<<"i "<<i<<endl;
        cout<<pow(2,i)<<endl;
        t--;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
//#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))

int main()
{
    ll t;
    cin>>t;
    while(t)
    {
        ll n,i,cnt=0;
        cin>>n;
        for(i=0;i<=n;i++)
        {
            //cout<<n^i<<" ";
            if((n^i)==n-i)
            {

                cnt++;
            }
        }
        cout<<cnt<<endl;
        t--;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
//#define my_sizeof(type) ((char *)(&type+1)-(char*)(&type))

int main()
{
    ll t,ans;
    cin>>t;
    while(t)
    {
        ll n,i=0;
        cin>>n;
        //cout<<"n1 "<<n<<endl;
        while(n>0)
        {
            //cout<<"n "<<n<<endl;
            n=n&(n-1);
            //cout<<"n "<<n<<endl;
            i++;
        }
        //cout<<"i "<<i<<endl;
        ans=pow(2,i);
        cout<<ans<<endl;
        t--;
    }
    return 0;
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    //fast;
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll ulim = log2(n);
        string binary = std::bitset<30>(n).to_string();
        //reverse(binary.begin(), binary.end());
        ll ans = 0;
        bool haha = false;
        rep(i,0,binary.length()-1)
        {
            if( binary[i]=='1' && haha==false )
                haha = true;
            if( binary[i]=='0' && haha )
                ans += pow(2,29-i);
        }
        //cout<<ulim<<"\n";
        //cout<<binary<<"\n";
        // rep(i,0,ulim)
        // {
        //     if( binary[i]=='0' )
        //     {
        //         ans += pow(2,i);
        //     }
        // }
        cout<<n-ans+1<<"\n";
    }
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    //fast;
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        string binary = std::bitset<30>(n).to_string();
        reverse(binary.begin(), binary.end());
        ll ans = 0;
        ll ulim = log2(n);
        //cout<<ulim<<"\n";
        //cout<<binary<<"\n";
        rep(i,0,ulim)
        {
            if( binary[i]=='0' )
            {
                ans += pow(2,i);
            }
        }
        cout<<n-ans+1<<"\n";
    }
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    //fast;
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        string binary = std::bitset<32>(n).to_string();
        reverse(binary.begin(), binary.end());
        ll ans = 0;
        ll ulim = log2(n);
        //cout<<ulim<<"\n";
        //cout<<binary<<"\n";
        rep(i,0,ulim)
        {
            if( binary[i]=='0' )
            {
                ans += pow(2,i);
            }
        }
        cout<<n-ans+1<<"\n";
    }
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        ll i = ones(n);
        ll ans = pow(2,i);
        cout<<ans<<endl;
    }
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    //fast;
    // ll t;
    // cin>>t;
    // while(t--)
    // {
    //     ll n;
    //     cin>>n;
    //     string binary = std::bitset<32>(n).to_string();
    //     reverse(binary.begin(), binary.end());
    //     ll ans = 0;
    //     ll ulim = log2(n);
    //     //cout<<ulim<<"\n";
    //     //cout<<binary<<"\n";
    //     rep(i,0,ulim)
    //     {
    //         if( binary[i]=='0' )
    //         {
    //             ans += pow(2,i);
    //         }
    //     }
    //     cout<<n-ans+1<<"\n";
    // }
    ll n, count = 0;
    cin>>n;
    rep(i,0,n)
    {
        if( (n^i) == (n-i) )
            count++;
    }
    cout<<count<<"\n";
}


/*
* Author: Aayush Tyagi
* Created: 16-10-2018 16:01:34
* Language: C++
*/
#include<iostream>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<unordered_set>
#include<map>
#include<bitset>
//#include<unordered_map>
#include<tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef vector<int> v32;
typedef vector<ll> v64;

ll MOD7 = 1e9+7;
ll MOD9 = 1e9+9;

#define pb push_back
#define mp make_pair
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define ones __builtin_popcount
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    //fast;
    // ll t;
    // cin>>t;
    // while(t--)
    // {
    //     ll n;
    //     cin>>n;
    //     string binary = std::bitset<32>(n).to_string();
    //     reverse(binary.begin(), binary.end());
    //     ll ans = 0;
    //     ll ulim = log2(n);
    //     //cout<<ulim<<"\n";
    //     //cout<<binary<<"\n";
    //     rep(i,0,ulim)
    //     {
    //         if( binary[i]=='0' )
    //         {
    //             ans += pow(2,i);
    //         }
    //     }
    //     cout<<n-ans+1<<"\n";
    // }
    ll t;
    cin>>t;
    while(t--){
    ll n, count = 0;
    cin>>n;
    rep(i,0,n)
    {
        if( (n^i) == (n-i) )
            count++;
    }
    cout<<count<<"\n";
    }
}


#include<bits/stdc++.h>

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define lop '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll mod1=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
//                                         EXTENDED_EUCLID
vector<ll>extended_Euclid(ll a,ll b){
    vector<ll>v(3);
    if(b==0){
        v[0]=a;v[1]=1;v[2]=0;
        return v;
    }
    else{
         vector<ll>v1 = extended_Euclid(b,a%b);    //recursive call
         v[0]=v1[0];
         v[1]=v1[2];
         v[2]=v1[1]-(a/b)*v1[2];
         return v;
    }
}
                                          // DFS ( number of connected components  )
//vector<vector<ll> >adj(200001);
//bool visited[200001];
/*ll dfs(int x,int c){                         // x - > node      c - > number of edges in the component
    if(visited[x])return c;
    else{
        visited[x]=true;
        int y=c;
        for(int i=0;i<adj[x].size();i++){
            if(!visited[adj[x][i]]){
                c+=1;
                int d=dfs(adj[x][i],y);
                c+=d;
            }
        }
        return c;
    }
}
*/
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
                               // Binary Search
/*
ll bin_search(ll y){
  while(lo<hi){
    x=lo+(hi-lo)/2;
    if(condition){
            .....
    }
    else{
                  // increase lo or decrease hi suitably
            }
   }
}
*/
int main(){
    boost;
    int TESTS=1;
    cin>>TESTS;
    while(TESTS--){
       ull a;
       cin>>a;
       ull c=0;
       c=__builtin_popcount(a);
       /*
       while(a>0){
        if(a%2!=0)c++;
        a/=2;
       }
       */
       cout<<power(2,c)<<endl;
    }
}
/* Be careful about integer ranges;
   Check the corner cases before submitting.
*/


#include<bits/stdc++.h>

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define lop '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll mod1=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
//                                         EXTENDED_EUCLID
vector<ll>extended_Euclid(ll a,ll b){
    vector<ll>v(3);
    if(b==0){
        v[0]=a;v[1]=1;v[2]=0;
        return v;
    }
    else{
         vector<ll>v1 = extended_Euclid(b,a%b);    //recursive call
         v[0]=v1[0];
         v[1]=v1[2];
         v[2]=v1[1]-(a/b)*v1[2];
         return v;
    }
}
                                          // DFS ( number of connected components  )
//vector<vector<ll> >adj(200001);
//bool visited[200001];
/*ll dfs(int x,int c){                         // x - > node      c - > number of edges in the component
    if(visited[x])return c;
    else{
        visited[x]=true;
        int y=c;
        for(int i=0;i<adj[x].size();i++){
            if(!visited[adj[x][i]]){
                c+=1;
                int d=dfs(adj[x][i],y);
                c+=d;
            }
        }
        return c;
    }
}
*/
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
                               // Binary Search
/*
ll bin_search(ll y){
  while(lo<hi){
    x=lo+(hi-lo)/2;
    if(condition){
            .....
    }
    else{
                  // increase lo or decrease hi suitably
            }
   }
}
*/
int main(){
    boost;
    int TESTS=1;
    cin>>TESTS;
    while(TESTS--){
       ull a;
       cin>>a;
       ull c=0;
       while(a>0){
        if(a%2!=0)c++;
        a/=2;
       }
       cout<<power(2,c)<<endl;
    }
}
/* Be careful about integer ranges;
   Check the corner cases before submitting.
*/


#include<bits/stdc++.h>

//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fwd(i,a,n) for(int i=a;i<n;i++)
#define bak(i,a,n) for(int i=a;i>=n;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define lop '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef set<int> si;
const ll mod = 1e9 + 7;
const ll mod1=998244353;
const double pie=3.1415926535;
                                                    //power
ll power(ll x,ll y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
//                                         EXTENDED_EUCLID
vector<ll>extended_Euclid(ll a,ll b){
    vector<ll>v(3);
    if(b==0){
        v[0]=a;v[1]=1;v[2]=0;
        return v;
    }
    else{
         vector<ll>v1 = extended_Euclid(b,a%b);    //recursive call
         v[0]=v1[0];
         v[1]=v1[2];
         v[2]=v1[1]-(a/b)*v1[2];
         return v;
    }
}
                                          // DFS ( number of connected components  )
//vector<vector<ll> >adj(200001);
//bool visited[200001];
/*ll dfs(int x,int c){                         // x - > node      c - > number of edges in the component
    if(visited[x])return c;
    else{
        visited[x]=true;
        int y=c;
        for(int i=0;i<adj[x].size();i++){
            if(!visited[adj[x][i]]){
                c+=1;
                int d=dfs(adj[x][i],y);
                c+=d;
            }
        }
        return c;
    }
}
*/
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/
                               // Binary Search
/*
ll bin_search(ll y){
  while(lo<hi){
    x=lo+(hi-lo)/2;
    if(condition){
            .....
    }
    else{
                  // increase lo or decrease hi suitably
            }
   }
}
*/
int main(){
    boost;
    int TESTS=1;
    cin>>TESTS;
    while(TESTS--){
       ull a;
       cin>>a;
       if(a%2==0)cout<<a/2+1<<endl;
       else cout<<a+1<<endl;
    }
}
/* Be careful about integer ranges;
   Check the corner cases before submitting.
*/


/***************************************************
 * Problem Name : B. Equations of Mathematical Magic.cpp
 * Problem Link : https://codeforces.com/contest/1064/problem/B
 * OJ           : Codeforces
 * Verdict      : Trying
 * Date         : 2018-10-27
 * Problem Type : Div 2 - B
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<cstring>
#include<string>
#include<sstream>
#include<cmath>
#include<vector>
#include<queue>
#include<cstdlib>
#include<deque>
#include<stack>
#include<map>
#include<set>
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define SET(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define pll pair <ll, ll>
#define debug cout <<"#########\n";
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define Pow2(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define Max3(a, b, c) max(a, max(b, c))
#define Min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

template <typename T>
std::string NumberToString ( T Number ) {
    std::ostringstream ss;
    ss << Number;
    return ss.str();
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    __FastIO;
    ll tc, n;
    cin >> tc;

    while (tc--) {
        cin >> n;
        ll x = __builtin_popcount (n);
        cout << (1 << x) << "\n";
    }

    return 0;
}


#include<iostream>
using namespace std;
int main(){
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        if(n == 0) cout << "1\n";
        else if(n%2 == 0) cout << n <<"\n";
        else cout << n+1<<"\n";
    }

    return 0;
}


#include<iostream>
using namespace std;
int main(){
    int t;
    cin >> t;
    while(t--){
        int n;
        cin >> n;
        if(n == 0) cout << "1\n";
        else if(n%1 == 0) cout << n <<"\n";
        else cout << n+1<<"\n";
    }

    return 0;
}


#include<iostream>
using namespace std;
int main(){
    int tc;
    cin >> tc;
    while(tc--){
        int n;
        cin >> n;
        if(n == 0) cout << "1\n";
        else if(n%2 == 0) cout << n <<"\n";
        else cout << n+1<<"\n";
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
using namespace std;
typedef long long li;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, c;
	cin >> a;
	int b = a;
	while (a > 1) {
		a /= 2;
	}
	if (a == 1) {
		cout << 2;
	}
	else {
		cout << b + 1;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
using namespace std;
typedef long long li;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c;
	cin >> a;
	int b = a;
	while (a > 1) {
		a /= 2;
	}
	if (a == 1) {
		cout << 2;
	}
	else {
		cout << b + 1;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
using namespace std;
typedef long long li;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, c;
	cin >> c;
	for (int i = 0; i < c; ++i) {
		cin >> a;
		int b = a;
		while (a > 1 && a%2 == 0) {
			a /= 2;

		}
		if (a == 1) {
			cout << 2 << endl;
		}
		else {
			cout << b + 1 << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
using namespace std;
typedef long long li;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, c;
	cin >> c;
	for (int i = 0; i < c; ++i) {
		cin >> a;
		int b = a;
		while (a > 1) {
			a /= 2;
		}
		if (a == 1) {
			cout << 2 << endl;
		}
		else {
			cout << b + 1 << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <stack>
#include <list>
using namespace std;
typedef long long li;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, c;
	cin >> c;
	for (int i = 0; i < c; ++i) {
		cin >> a;
		int b = 0;
		for (int j = 0; j < 31; ++j) {
			b += (a & 1);
			a = a >> 1;
		}
		int ans = 1;
		for (int j = 0; j < b; ++j) {
			ans *= 2;
		}
		cout << ans << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
#include<cmath>
using namespace std;

int dec_to_bin(long long int a)
{
    int binary[32]={0};
    int i=0;
    while(a>0)
    {
        binary[i]=a%2;
        a/=2;
        i++;
    }
    int total=0;
    for(int i=0;i<32;i++)
    {
        if(binary[i])
        {
            total++;
        }
    }
    return total;
}

int foo(int a,int x)
{
    return (a-(a^x)-x);
}
int main()
{
    int t,x;
    cin>>t;
    long long arr[t];
    long long res[t];
    fill(res,res+t,0);
//    for(int i=0;i<t;i++)
//        arr[i]=i;
    for(int i=0;i<t;i++)
        cin>>arr[i];
    for(int i=0;i<t;i++)
    {
        int total = dec_to_bin(arr[i]);
        res[i] = pow(2,total);
    }
//    for(int i=0;i<t;i++)
//    {
//        if(arr[i]==0)
//        {
//            res[i]=1;
//            continue;
//        }
//        if(((arr[i]-1)&(arr[i]))==0)
//        {
//            res[i]=2;
//            continue;
//        }
//        if(((arr[i]+1)&(arr[i]))==0)
//        {
//            res[i]=arr[i]+1;
//            continue;
//        }
//        if(arr[i]%4==0)
//        {
//            while(arr[i]%4==0)
//            {
//                arr[i]/=4;
//            }
//            for(int j=0;j<=arr[i];j++)
//            {
//                if(!foo(arr[i],j))
//                    res[i]++;
//            }
//        }
//        if(arr[i]%10==0)
//        {
//            if(arr[i]%3==0)
//                res[i]=16;
//            else if(((arr[i]%10)-1)&(arr[i]%10)==0)
//            {
//                res[i]=4;
//            }
//            else
//                res[i]=8;
//            continue;
//        }
//        for(long long j=0;j<=arr[i];j++)
//        {
//            if(!foo(arr[i],j))
//            {
//                res[i]++;
//            }
//        }
//    }
    for(int i=0;i<t;i++)
        cout<<res[i]<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int foo(int a,int x)
{
    return (a-(a^x)-x);
}
int main()
{
    int t,x;
    cin>>t;
    long long arr[t];
    long long res[t];
    fill(res,res+t,0);
//    for(int i=0;i<t;i++)
//        arr[i]=i;
    for(int i=0;i<t;i++)
        cin>>arr[i];
    for(int i=0;i<t;i++)
    {
        if(arr[i]==0)
        {
            res[i]=1;
            continue;
        }
        if(((arr[i]-1)&(arr[i]))==0)
        {
            res[i]=2;
            continue;
        }
        if(((arr[i]+1)&(arr[i]))==0)
        {
            res[i]=arr[i]+1;
            continue;
        }
        if(arr[i]%4==0)
        {
            while(arr[i]%4==0)
            {
                arr[i]/=4;
            }
            for(int j=0;j<=arr[i];j++)
            {
                if(!foo(arr[i],j))
                    res[i]++;
            }
        }
        if(arr[i]%10==0)
        {
            if(arr[i]%3==0)
                res[i]=16;
            else if(((arr[i]%10)-1)&(arr[i]%10)==0)
            {
                res[i]=4;
            }
            else
                res[i]=8;
            continue;
        }
        for(long long j=0;j<=arr[i];j++)
        {
            if(!foo(arr[i],j))
            {
                res[i]++;
            }
        }
    }
    for(int i=0;i<t;i++)
        cout<<arr[i]<<": "<<res[i]<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int foo(int a,int x)
{
    return (a-(a^x)-x);
}
int main()
{
    int t,x;
    cin>>t;
    long long arr[t];
    long long res[t];
    fill(res,res+t,0);
//    for(int i=0;i<t;i++)
//        arr[i]=i;
    for(int i=0;i<t;i++)
        cin>>arr[i];
    for(int i=0;i<t;i++)
    {
        if(arr[i]==0)
        {
            res[i]=1;
            continue;
        }
        if(((arr[i]-1)&(arr[i]))==0)
        {
            res[i]=2;
            continue;
        }
        if(((arr[i]+1)&(arr[i]))==0)
        {
            res[i]=arr[i]+1;
            continue;
        }
        if(arr[i]%4==0)
        {
            while(arr[i]%4==0)
            {
                arr[i]/=4;
            }
            for(int j=0;j<=arr[i];j++)
            {
                if(!foo(arr[i],j))
                    res[i]++;
            }
        }
        if(arr[i]%10==0)
        {
            if(arr[i]%3==0)
                res[i]=16;
            else if(((arr[i]%10)-1)&(arr[i]%10)==0)
            {
                res[i]=4;
            }
            else
                res[i]=8;
            continue;
        }
        for(long long j=0;j<=arr[i];j++)
        {
            if(!foo(arr[i],j))
            {
                res[i]++;
            }
        }
    }
    for(int i=0;i<t;i++)
        cout<<res[i]<<endl;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    long long int a[t];
    long long int x[t];
    for(int i=0;i<t;i++)
    {
        cin>>a[i];
    }
    for(int i=0;i<t;i++)
    {
        x[i] = a[i];
        cout<<x[i]<<endl;
    }
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int t,m;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> m;
		int count = 0;
		while (m) {
			if (m % 2 == 1)
				count++;
			m /= 2;
		}
		cout << pow(2, count);
	}
}


#include <iostream>
using namespace std;

int main() {
	int t;
	long long m;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> m;
		int count = 0;
		while (m) {
			if (m % 2 == 1)
				count++;
			m /= 2;
		}
		cout << (long long) (1 <<count) << endl;
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int t;
	long long m;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> m;
		int count = 0;
		while (m) {
			if (m % 2 == 1)
				count++;
			m /= 2;
		}
		cout << (long long)pow(2, count) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>

#include <algorithm>
#include <functional>

#define N 1000000 + 5 /* 1e6 +  5 */

#define IOS ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define endl '\n'

#define PQ priority_queue

#define forn(x, y, z) for (int x = y; x < z; ++x)

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define init(x, y) memset((x), (y), sizeof(x))

#define pii pair<int, int>
#define piii pair<int, pii>

#define pb push_back
#define eb emplace_back

#define fs first
#define sc second

using namespace std;

typedef long long lint;

/*
bool chk[N];

vector<lint> get_prime(lint max_n) {
	vector<lint> ret;
	for (lint i = 2; i * i <= max_n; ++i) if (chk[i] == false) {
		ret.emplace_back(i);
		for (lint j = i + i; j <= max_n; ++j) {
			chk[j] = true;
		}
	}
	return ret;
}
*/

lint gcd(lint a, lint b) {
	a = abs(a), b = abs(b);
	if (a < b) swap(a, b);
	return b ? gcd(b, a % b) : a;
}

lint lcm(lint a, lint b) { return a * b / gcd(a, b); }

lint fast_pow(lint x, lint exp, lint mod) {
	lint ret = 1;
	while (exp) {
		if (exp & 1) ret = (ret * x) % mod;
		x = (x * x) % mod;
		exp >>= 1;
	}
	return ret;
}

const int dx[] = { 0, 0, -1, 1 };
const int dy[] = { -1, 1, 0, 0 };

const int inf = (int)2e9 + 5;

vector<vector<int> > adj;
vector<int> v;

PQ<int> q;
map<int, int> mp;
set<int> st;

lint a;

int32_t main(void)
{
	IOS;

	int tc;
	cin >> tc;

	forn(test_case, 0, tc) {
		cin >> a;

		int r = 0;

		while (a) {
			r += (a & 1);
			a >>= 1;
		}

		cout << fast_pow(2, r, inf) << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>

#include <algorithm>
#include <functional>

#define N 1000000 + 5 /* 1e6 +  5 */

#define IOS ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define endl '\n'

#define PQ priority_queue

#define forn(x, y, z) for (int x = y; x < z; ++x)

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define init(x, y) memset((x), (y), sizeof(x))

#define pii pair<int, int>
#define piii pair<int, pii>

#define pb push_back
#define eb emplace_back

#define fs first
#define sc second

using namespace std;

typedef long long lint;

/*
bool chk[N];

vector<lint> get_prime(lint max_n) {
	vector<lint> ret;
	for (lint i = 2; i * i <= max_n; ++i) if (chk[i] == false) {
		ret.emplace_back(i);
		for (lint j = i + i; j <= max_n; ++j) {
			chk[j] = true;
		}
	}
	return ret;
}
*/

lint gcd(lint a, lint b) {
	a = abs(a), b = abs(b);
	if (a < b) swap(a, b);
	return b ? gcd(b, a % b) : a;
}

lint lcm(lint a, lint b) { return a * b / gcd(a, b); }

lint fast_pow(lint x, lint exp, lint mod) {
	lint ret = 1;
	while (exp) {
		if (exp & 1) ret = (ret * x) % mod;
		x = (x * x) % mod;
		exp >>= 1;
	}
	return ret;
}

const int dx[] = { 0, 0, -1, 1 };
const int dy[] = { -1, 1, 0, 0 };

const int inf = (int)2e9 + 5;

vector<vector<int> > adj;
vector<int> v;

PQ<int> q;
map<int, int> mp;
set<int> st;

lint a;

int32_t main(void)
{
	IOS;

	int tc;
	cin >> tc;

	forn(test_case, 0, tc) {
		cin >> a;

		int r = 0;

		forn(i, 0, 30) if (a & (1 << i)) {
			++r;
		}

		cout << fast_pow(2, r, inf) << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>

#include <algorithm>
#include <functional>

#define N 1000000 + 5 /* 1e6 +  5 */

#define IOS ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define endl '\n'

#define PQ priority_queue

#define forn(x, y, z) for (int x = y; x < z; ++x)

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define init(x, y) memset((x), (y), sizeof(x))

#define pii pair<int, int>
#define piii pair<int, pii>

#define pb push_back
#define eb emplace_back

#define fs first
#define sc second

using namespace std;

typedef long long lint;

/*
bool chk[N];

vector<lint> get_prime(lint max_n) {
	vector<lint> ret;
	for (lint i = 2; i * i <= max_n; ++i) if (chk[i] == false) {
		ret.emplace_back(i);
		for (lint j = i + i; j <= max_n; ++j) {
			chk[j] = true;
		}
	}
	return ret;
}
*/

lint gcd(lint a, lint b) {
	a = abs(a), b = abs(b);
	if (a < b) swap(a, b);
	return b ? gcd(b, a % b) : a;
}

lint lcm(lint a, lint b) { return a * b / gcd(a, b); }

lint fast_pow(lint x, lint exp, lint mod) {
	lint ret = 1;
	while (exp) {
		if (exp & 1) ret = (ret * x) % mod;
		x = (x * x) % mod;
		exp >>= 1;
	}
	return ret;
}

const int dx[] = { 0, 0, -1, 1 };
const int dy[] = { -1, 1, 0, 0 };

const int inf = (int)2e9 + 5;

vector<vector<int> > adj;
vector<int> v;

PQ<int> q;
map<int, int> mp;
set<int> st;

lint a;

int32_t main(void)
{
	IOS;

	int tc;
	cin >> tc;

	forn(test_case, 0, tc) {
		cin >> a;

		int r = 0;

		while (a) {
			r += (a & 1);
			a >>= 1;
		}

		cout << (1 << r) << endl;
	}

	return 0;
}


#include<bits/stdc++.h>
#define inf 1000000009
using namespace std;
typedef long long ll;

ll binexp(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll t;
    cin >> t;

    while (t--) {
        ll a;
        cin >> a;

        if (a == 0)
            cout << 0 << endl;
        else {
            ll bits = __builtin_popcount(a);
            ll ans = pow(2, bits);

            cout << ans << endl;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
#define inf 1000000009
using namespace std;
typedef long long ll;

ll binexp(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll t;
    cin >> t;

    while (t--) {
        ll a;
        cin >> a;

        if (ceil(log2(a)) == floor(log2(a)))
            cout << 2 << endl;
        else {
            ll ans;
            ll p = ceil(log2(a));
            if (a == pow(2, p) - 1)
                ans = pow(2, p);
            else
                ans = ll(4);

            cout << ans << endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define inf 1000000009
using namespace std;
typedef long long ll;

ll binexp(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll t;
    cin >> t;

    while (t--) {
        ll a;
        cin >> a;

        if (a == 0)
            cout << 1 << endl;
        else {
            if (ceil(log2(a)) == floor(log2(a)))
                cout << 2 << endl;
            else {
                ll ans;
                ll p = ceil(log2(a));
                if (a == pow(2, p) - 1)
                    ans = pow(2, p);
                else
                    ans = ll(4);

                cout << ans << endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define inf 1000000009
using namespace std;
typedef long long ll;

ll binexp(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll t;
    cin >> t;

    while (t--) {
        ll a;
        cin >> a;

        ll bits = __builtin_popcount(a);
        ll ans = pow(2, bits);

        cout << ans << endl;

    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;1

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		long long a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a & 1);
			a /= 2;
		}
		cout << pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		long long a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a % 2);
			a /= 2;
		}
		cout << pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		long long a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a & 1);
			a >>= 1;
		}
		cout << (long long)pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		int a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a % 2);
			a /= 2;
		}
		cout << pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		long long a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a & 1);
			a /= 2;
		}
		cout << pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>
#include <functional>

using namespace std;

int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while (t--)
	{
		long long a, cnt = 0;
		cin >> a;
		while (a)
		{
			cnt += (a & 1);
			a >>= 2;
		}
		cout << (long long)pow(2, cnt) << endl;
	}
	return 0;
}


#include <iostream>

using namespace std;

void task()
{
    char c;
    int n = 0;
    while((c = getchar()) != 10){
//cout << (int)c << '#';
        n = n * 10 + (c - '0');
    }
//cout << endl;

    int res = 1;
    while(n){
        if(n & 1)
            res <<= 1;
        n >>= 1;
    }
    cout << res << endl;
}

int main()
{
//    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n; getchar();
    for(int i = 0; i < n; ++i)
        task();
    return 0;
}


#include <iostream>

using namespace std;

void task()
{
    char c;
    int n = 0;
    while((c = getchar()) != 10){
cout << (int)c << '#';
        n = n * 10 + (c - '0');
    }
cout << endl;

    int res = 1;
    while(n){
        if(n & 1)
            res <<= 1;
        n >>= 1;
    }
    cout << res << endl;
}

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(nullptr);

    int n;
    cin >> n; getchar();
    for(int i = 0; i < n; ++i)
        task();
    return 0;
}


#include <iostream>

using namespace std;

void task()
{
    char c;
    int n = 0;
    while((c = getchar()) != 10){
//cout << (int)c << '#';
        n = n * 10 + (c - '0');
    }
//cout << endl;

    int res = 1;
    while(n){
        if(n & 1)
            res <<= 1;
        n >>= 1;
    }
    cout << res << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n; getchar();
    for(int i = 0; i < n; ++i)
        task();
    return 0;
}


#include <iostream>

using namespace std;

void task()
{
    int n;
    cin >> n;
    int res = 1;
    while(n){
        if(n & 1)
            res <<= 1;
        n >>= 1;
    }
    cout << res << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    for(int i = 0; i < n; ++i)
        task();
    return 0;
}


#include <iostream>

using namespace std;

void task()
{
    char c;
    int n = 0;
    while((c = getchar()) != 10){
//cout << (int)c << '#';
        n = n * 10 + (c - '0');
    }
//cout << endl;

    int res = 1;
    while(n){
        if(n & 1)
            res <<= 1;
        n >>= 1;
    }
    cout << res << endl;
}

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(nullptr);

    int n;
    cin >> n; getchar();
    for(int i = 0; i < n; ++i)
        task();
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
struct point{
   lli  x,y;
};
int main()
{
   lli  t,x;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      if(!x){
         printf("1\n");
         continue;
      }
      //lli s=x-(x^2)-2;
    //  printf("%lld \n",s);
      for(lli u=1;u<=40;u++){
           lli m=x-(x^(1<<u))-(1<<u);
           if(!m)  {
              m=1<<u;
               printf( "%lld\n",m);
               break;
           }
      }

   }
}

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
int main()
{
   lli  t,x,cnt,a;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      cnt=0;
      while(x){
         cnt+=x&1;
         x>>=1;
      }
      cnt=1<<cnt;
      printf("%lld\n",cnt);
   }

}
//https://www.geeksforgeeks.org/bitwise-algorithms/

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
struct point{
   lli  x,y;
};
int main()
{
   lli  t,x;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      if(!x){
         printf("1\n");
         continue;
      }
      lli s=log2(x),u;

      for(u=1;u<=62;u++){
         lli r=1<<u;
       //  printf("%lld ",r);
         lli xr=x xor  r;
         lli m=x-xr-r;
         if( r>=x ){
             printf("%lld \n",r );
              break;
         }

      }

   }
}

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
struct point{
   lli  x,y;
};
int main()
{
   lli  t,x;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
     lli a=log2(x);
   a=1<<a;
   if(a==x) printf("%lld\n",x);
   else printf("%lld\n",x+1);
   }
}

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
int main()
{
   lli  t,x,cnt,a;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      cnt=__builtin_popcount(x);
      cnt=1<<cnt;
      printf("%lld\n",cnt);
   }

}
//https://www.geeksforgeeks.org/bitwise-algorithms/

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
int main()
{
   lli  t,x,cnt,a;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      cnt=0;
      while(x){
        x&=(x-1);
        cnt++;
      }
      cnt=1<<cnt;
      printf("%lld\n",cnt);
   }

}
//https://www.geeksforgeeks.org/bitwise-algorithms/

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
struct point{
   lli  x,y;
};
int main()
{
   lli t,a;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&a);
      if(!a){
         printf("1\n");
         continue;
      }
       lli x=log2(a);
       lli s=1<<x;
       if(s!=a) x++;
       s=1<<x;
        printf("%lld\n",s);
   }

}

//http://codeforces.com/contest/2/problem/B


#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
int main()
{
   lli  t,x,cnt;
   scanf("%lld",&t);
   while(t--){
      scanf("%lld",&x);
      cnt=0;
      for(lli i=0;i<40;i++){
           lli a=pow(2,i);
          if( a&x ){
           //  printf("%lld %lld \n",a,x);
              cnt++;
          }
      }
      cnt=1<<cnt;
      printf("%lld\n",cnt);
   }

}
//https://www.geeksforgeeks.org/bitwise-algorithms/

//http://codeforces}.com/contest/2/problem/https://www.onlinegdb.com/online_c_compiler#tab-stdin


#include<bits/stdc++.h>
#define ll long long
#define in(n) ll a[n];for(i=0;i<n;i++) cin>>a[i];
#define u_can ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep for(i=0;i<n;i++)
#define nn cout<<endl
#define rep1(i,p,q) for(i=p;i<q;i++)
using namespace std;
int isprime(ll p)
{
    for(ll i=2;i*i<=p;i++)
    {
        if(p%i==0)
            return 0;
    }
    return 1;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
   ll t=1,i=0,j=0;
   ll a[31];
   a[30]=0;
   for(i=29;i>=0;i--)
   {
       a[i]=pow(2,j);
       j++;
   }
   cin>>t;
   while(t--)
   {
        ll n,ans=0,p=0;
        cin>>n;
        i=0;
        for(i=0;i<30;i++)
        {
           // cout<<"\nn= "<<n;
            if(n>=a[i])
            {
                n-=a[i];
                ans++;
            }
        }
      // cout<<"\nans= "<<ans;nn;
       /*while(ans>0)
        {
            p=p+ans;
            ans--;
            //cout<<"\np= "<<p;nn;
        }*/
        cout<<(int)pow(2,ans);nn;
        //cout<<p;n;
   }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   ll t=1,i=0,j=0;
   cin>>t;
   while(t--)
   {
      ll n;
      cin>>n;
      ll x=_builtin_popcount(n);
      cout<<(int)pow(2,x);
      nn;
   }
}


#include<bits/stdc++.h>
#define ll long long
#define in(n) ll a[n];for(i=0;i<n;i++) cin>>a[i];
#define u_can ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep for(i=0;i<n;i++)
#define nn cout<<endl
#define rep1(i,p,q) for(i=p;i<q;i++)
using namespace std;
int isprime(ll p)
{
    for(ll i=2;i*i<=p;i++)
    {
        if(p%i==0)
            return 0;
    }
    return 1;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    u_can;
    //cout<<"\n\nhiiiiiiiii ";
  ll t=1,i,j,p,q;
  cin>>t;
  ll a[30],sum=1;
  for(i=0;i<30;i++)
  {
      a[i]=sum;
      sum*=2;
  }

  while(t--)
  {
      ll n,ans;
      cin>>n;
      if(n==0)
        ans=1;
      else if(n%2==0)
      {
          rep1(i,0,30)
          {
              if(n==a[i])
                break;
          }
          if(n==30)
            ans=3;
          else
            ans=2;
      }
      else if(n%2!=0)
        ans=n+1;
      cout<<ans;
      nn;
  }
}


#include<bits/stdc++.h>
#define ll long long
#define in(n) ll a[n];for(i=0;i<n;i++) cin>>a[i];
#define u_can ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep for(i=0;i<n;i++)
#define nn cout<<endl
#define rep1(i,p,q) for(i=p;i<q;i++)
using namespace std;
int isprime(ll p)
{
    for(ll i=2;i*i<=p;i++)
    {
        if(p%i==0)
            return 0;
    }
    return 1;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
   ll t=1,i=0,j=0;
   ll a[31];
   a[30]=0;
   for(i=29;i>=0;i--)
   {
       a[i]=pow(2,j);
       j++;
   }
   cin>>t;
   while(t--)
   {
        ll n,ans=0,p=0;
        cin>>n;
        i=0;
        for(i=0;i<30;i++)
        {
           // cout<<"\nn= "<<n;
            if(n>=a[i])
            {
                n-=a[i];
                ans++;
            }
        }
      // cout<<"\nans= "<<ans;nn;
       /*while(ans>0)
        {
            p=p+ans;
            ans--;
            //cout<<"\np= "<<p;nn;
        }*/
        cout<<pow(2,ans);nn;
        //cout<<p;n;
   }
}


#include<bits/stdc++.h>
#define ll long long
#define in(n) ll a[n];for(i=0;i<n;i++) cin>>a[i];
#define u_can ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep for(i=0;i<n;i++)
#define nn cout<<endl
#define rep1(i,p,q) for(i=p;i<q;i++)
using namespace std;
int isprime(ll p)
{
    for(ll i=2;i*i<=p;i++)
    {
        if(p%i==0)
            return 0;
    }
    return 1;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
   ll t=1,i=0,j=0;
   cin>>t;
   while(t--)
   {
      ll n;
      cin>>n;
      ll x=_builtin_popcount(n);
      cout<<(int)pow(2,x);
      nn;
   }
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin>>t;
   while(t--){
       int a;
       cin>>a;
       int cnt=0;
       int x;
  while(a>0)
 {
  x=a%2;
  if(x==1)
    cnt++;
  a= a/2;
  }
  cout<<pow(2,cnt)<<endl;
   }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin>>t;
   while(t--){
       long long a;
       cin>>a;
       long long cnt=0;
       int x;
  while(a>0)
 {
  x=a%2;
  if(x==1)
    cnt++;
  a= a/2;
  }
  cout<<pow(2,cnt)<<endl;
   }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin>>t;
   while(t--){
       long long a;
       cin>>a;
       long long cnt=0;
       int x;
  while(a>0)
 {
  x=a%2;
  if(x==1)
    cnt++;
  a= a/2;
  }
  cout<<(int)pow(2,cnt)<<endl;
   }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
    int a,t;
    cin>>t;
    while(t--)
    {
        cin>>a;
        int Map[50];
        memset(Map,0,sizeof(Map));
        int b=a;
        int num=0;
        while(b){
            Map[num++]=b%2;
            b/=2;
        }
        int ans=1;
        for(int i=0;i<num;i++)
        {
            if(Map[i]==1) ans*=2;
            //cout<<Map[i]<<" ";
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
    int a,t;
    cin>>t;
    while(t--)
    {
        cin>>a;
        int Map[50];
        memset(Map,0,sizeof(Map));
        int b=a;
        int num=0;
        while(b){
            Map[num++]=b%2;
            b/=2;
        }
        int ans=1;
        for(int i=0;i<num;i++)
        {
            if(Map[i]==1) ans*=2;
            //cout<<Map[i]<<" ";
        }
        cout<<ans;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
    int a,t;
    cin>>t;
    while(t--)
    {
        cin>>a;
        int ans=0;
        for(int i=0;i<=a;i++)
        {
            if((a-i)==(a^i)) ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main()
{
    int a,t;
    cin>>t;
    while(t--)
    {
        cin>>a;
        int Map[50];
        memset(Map,0,sizeof(Map));
        int b=a;
        int num=0;
        while(b){
            Map[num++]=b%2;
            b/=2;
        }
        int ans=1;
        for(int i=0;i<num;i++)
        {
            if(Map[i]==1) ans*=2;
            //cout<<Map[i]<<" ";
        }
        cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
signed main()
{
	long long t;
	cin >> t;
	while(t--);
	{
		long long n;
		cin >> n;
		long long t=pow(2,__builtin_popcountll(n));
		cout << t;
	}
}


#include<bits/stdc++.h>
using namespace std;
signed main()
{
	long long t;
	cin >> t;
	while(t--);
	{
		long long n;
		cin >> n;
		long long t=pow(2,__builtin_popcountll(n));
		cout << t<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
signed main()
{
	long long t;
	cin >> t;
	while(t--);
	{
		long long n;
		cin >> n;
		if(n%2==0)
		{
			cout << n;
		}
		else
		{
			cout << n+1;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
signed main()
{
	long long t;
	cin >> t;
	while(t--)
	{
		long long n;
		cin >> n;
		long long p=pow(2,__builtin_popcountll(n));
		cout << p<<endl;
	}
}


#include <iostream>

using namespace std;
unsigned long long int mas[1001];
int main()
{
    int k;
    cin>>k;
    for(int i=1;i<=k;i++){
        cin>>mas[i];
    }
    for(int i=1;i<=k;i++){
            if(mas[i]%2==0){
        cout<<mas[i]<<endl;}
        else{cout<<mas[i]+1<<endl;}
    }
    return 0;
}


#include <iostream>

using namespace std;
unsigned long long int mas[1001];
int main()
{
    int k,x=0,stp;
    cin>>k;
    for(int i=1;i<=k;i++){
        cin>>mas[i];
    }
    for(int i=1;i<=k;i++){
        stp=0;
        x=mas[i];
        while(x>0){x=x/2; stp++;}
        cout<<(1<<stp)<<endl;
    }
//    for(int j=1; j<=k; j++){
//            cout<<'|'<<mas[j]<<'|'<<endl;
//    for(long long int i=0;i<=mas[j]; i++){if(mas[j]-(mas[j]^i)-i==0){cout<<'*'<<i<<endl; x++;}}
//    cout<<x<<endl;
//    x=0;
// }
}


#include <iostream>

using namespace std;
unsigned long long int mas[1001];
int main()
{
    int k,x=0,stp;
    cin>>k;
    for(int i=1;i<=k;i++){
        cin>>mas[i];
    }
    for(int i=1;i<=k;i++){
        stp=0;
        x=mas[i];
        while(x>0) {
            if(x%2!=0){stp++;}
            x=x/2;
        }
        cout<<(1<<stp)<<endl;
    }
//    for(int j=1; j<=k; j++){
//            cout<<'|'<<mas[j]<<'|'<<endl;
//    for(long long int i=0;i<=mas[j]; i++){if(mas[j]-(mas[j]^i)-i==0){cout<<'*'<<i<<endl; x++;}}
//    cout<<x<<endl;
//    x=0;
// }
}


#include <iostream>

using namespace std;
unsigned long long int mas[1001];
int main()
{
    int k;
    cin>>k;
    for(int i=1;i<=k;i++){
        cin>>mas[i];
    }
    for(int i=1;i<=k;i++){
            if((mas[i]%2==0)&&(mas[i]!=0)){
        cout<<mas[i]<<endl;}
        else{cout<<mas[i]+1<<endl;}
    }
    return 0;
}


#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define max(x, y) (x >= y ? x : y)
#define min(x, y) (x <= y ? x : y)
#define log1(x) cout << "log: " << x << endl;
#define log2(x, y) cout << "log: " << x << " | " << y << endl;
#define log3(x, y, z) cout << "log: " << x << " | " << y << " | " << z << endl;

int main(){
  int t;
  cin>>t;
  for(int i=0;i<t;i++){
    int n;
    cin>>n;
    if(n%2)
      cout<<n+1<<endl;
      else
    cout<<2<<endl;

  }
  return 0;
}


#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define max(x, y) (x >= y ? x : y)
#define min(x, y) (x <= y ? x : y)
#define log1(x) cout << "log: " << x << endl;
#define log2(x, y) cout << "log: " << x << " | " << y << endl;
#define log3(x, y, z) cout << "log: " << x << " | " << y << " | " << z << endl;
int count(long long n){
  int c = n%2;
  while(n>>=1){
    if(n%2 == 1) c++;
  }
  return c;
}
int main(){
  int t;
  cin>>t;
  for(int i=0;i<t;i++){
    long long n;
    long long a;
    cin>>n;
    if(n==0)
      a = 1;
    else
      a = pow(2,count(n));
    cout<<a<<endl;
  }
  // cout<<count(t)<<endl;
  return 0;
}


#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define max(x, y) (x >= y ? x : y)
#define min(x, y) (x <= y ? x : y)
#define log1(x) cout << "log: " << x << endl;
#define log2(x, y) cout << "log: " << x << " | " << y << endl;
#define log3(x, y, z) cout << "log: " << x << " | " << y << " | " << z << endl;

int main(){
  int t;
  cin>>t;
  for(int i=0;i<t;i++){
    int n;
    cin>>n;
    if(n==0)
      cout<<1<<endl;
    else if(n%2!=0)
      cout<<n+1<<endl;
    else
      cout<<2<<endl;

  }
  return 0;
}


#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>
using namespace std;
#define max(x, y) (x >= y ? x : y)
#define min(x, y) (x <= y ? x : y)
#define log1(x) cout << "log: " << x << endl;
#define log2(x, y) cout << "log: " << x << " | " << y << endl;
#define log3(x, y, z) cout << "log: " << x << " | " << y << " | " << z << endl;

int main(){
  int t;
  cin>>t;
  for(int i=0;i<t;i++){
    long long n;
    cin>>n;
    if(n==0)
      cout<<1<<endl;
    else if(n%2!=0)
      cout<<n+1<<endl;
    else
      cout<<2<<endl;

  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<math.h>
#include<stdio.h>

int main()
{
    long long int t,a,count,z=0,i,r,ans;
    scanf("%lld",&t);
    for(i=1;i<=t;i++)
    {
        count=0;
        z=0;
        scanf("%lld",&a);
        if(a==0)
        {
        printf("1\n");
        continue;
        }

        while(1)
        {
            r = a%2;
           if(r==0)
           z=1;
            count++;

            a = a/2;

            if(a==1)
            {
                count++;
                break;
            }
        }

        if(z==1)
        count--;

        ans = pow(2,count);
        printf("%lld\n",ans);

    }
    return 0;
}


t=int(input())
for i in range(t):
    x=int(input())
    ans=8
    u=0
    an=""
    n=0

    if x<=4:

        for i in range(u+1,x):
            ans+=(9)*(10**i)
        print(ans)
    else:
        q=(x-1)//4

        for i in range(q):
            ans+=(8)*(10**(i+1))
        for i in range(q+1,x):
            ans+=(9)*(10**i)
        print(ans)


t=int(input())
for i in range(t):
    x=int(input())
    ans=8
    u=0
    an=""
    n=0

    if x<=4:

        for i in range(u+1,x):
            ans+=(9)*(10**i)
        print(ans)
    else:
        a=""
        q=(x-1)//4
        a+='9'*(x-q-1)
        a+='8'*(q+1)

        print(int(a))


def solve(n):
    k = (n - 1) // 4 + 1
    return "9" * (n - k) + "8" * k
def main():
    t = int(input())
    for i in range(t):
        n = int(input())
        print(solve(n))
main()


def solve(n):
    k = n // 5 + 1
    return "9" * (n - k) + "8" * k
def main():
    t = int(input())
    for i in range(t):
        n = int(input())
        print(solve(n))
main()


def solve(n):
    return "9" * (n - 1) + "8"
def main():
    t = int(input())
    for i in range(t):
        n = int(input())
        print(solve(n))
main()


for _t in range(int(input())):
    n = int(input())
    s = ['8' for i in range (1 + (n-1)//4)]
    while len(s) < n:
        s += '9'
    print(*s[::-1], sep = '')


for _t in range(int(input())):
    n = int(input())
    s = ['8' for i in range (1 + n//4)]
    while len(s) < n:
        s += '9'
    print(*s[::-1], sep = '')


for s in range(int(input())):
    n=int(input())
    rama=[]
    for i in range(n-1):
        rama.append(9)
    rama.append(8)
    for i in rama:
        print(i,end='')
    print()


for s in range(int(input())):
    n=int(input())
    rama=[]
    d=n//4
    d+=1
    for i in range(n-d):
        rama.append(9)
    for i in range(d):
        rama.append(8)
    for i in rama:
        print(i,end='')
    print()


for s in range(int(input())):
    n=int(input())
    rama=[]
    d=n//4
    if(d%4!=0):
        d+=1
    for i in range(n-d):
        rama.append(9)
    for i in range(d):
        rama.append(8)
    for i in rama:
        print(i,end='')
    print()


for s in range(int(input())):
    n=int(input())
    rama=[]
    d=n//4
    if(n%4!=0):
        d+=1
    for i in range(n-d):
        rama.append(9)
    for i in range(d):
        rama.append(8)
    for i in rama:
        print(i,end='')
    print()


for _ in range(int(input())):
    n = int(input())
    print("9" * n)


for _ in range(int(input())):
    n = int(input())
    print("9" * (n - 1) + "8")


for _ in range(int(input())):
    n = int(input())
    if n % 4 == 0:
        print("9" * n)
    else:
        print("9" * (n - 1) + "8")


for t in range(int(input())):
	n = int(input())
	l = ((n - 1) >> 2) + 1
	print('9'*(n - l) + '8'*l)


for t in range(int(input())):
	n = int(input())
	l = (n + 3) >> 2
	print('9'*(n - l) + '8'*l)


for t in range(int(input())):
	n = int(input())
	l = ((n - 1) >> 2) + 1
	print('9'*(n - l), '8'*l)


import sys

for b in range(0,int(sys.stdin.readline())):
  x = int(sys.stdin.readline())

  zero = int(x/4)
  nine = x-1-int((x-1)/4)
  eight = int(not x%4==0) + int(x/4)
  out = "9"*nine+"8"*eight
  sys.stdout.write(out+"\n")
  #sys.stdout.write("1001 "*nine+"1000 "*eight+"\n")


import sys

for b in range(0,int(sys.stdin.readline())):
  x = int(sys.stdin.readline())

  zero = int(x/4)
  nine = x-1-int((x-1)/4)
  eight = int(not x%4==0)
  out = "9"*nine+"8"*eight+"0"*zero
  sys.stdout.write(out+"\n")


import sys

for b in range(0,int(sys.stdin.readline())):
  x = int(sys.stdin.readline())

  zero = int(x/4)
  nine = x-1-zero
  eight = int(not x%4==0)
  out = "9"*nine+"8"*eight+"0"*zero
  sys.stdout.write(out+"\n")


for _ in range(int(input())):
    n = int(input())
    print("9"*(n-1)+"8")


from math import ceil
for _ in range(int(input())):
    n = int(input())
    x = ceil(n/4)
    print("9"*(n-x)+("8")*x)


for _ in range(int(input())):
    n = int(input())
    if(n == 1):
        print(8)
    elif(n == 2):
        print(99)
    elif(n == 3):
        print(998)
    else:
        print("9"*n)


for _ in range(int(input())):
    n=int(input())
    print('9'*(n-1)+'8')


for _ in range(int(input())):
    n=int(input())
    a=((n//4)+1)
    print('9'*(n-a)+'8'*a)


for _ in range(int(input())):
    n=int(input())
    print('9'*(n-1)+'9')


import re
t=int(input())
for _ in range(t):
    n=int(input())
    if(n==1):
        print(8)
    elif(n==2):
        print(98)
    elif(n==3):
        print(998)
    elif(n==4):
        print(9998)
    else:
        k=4
        s=''
        x=n%k
        e=n//k
        s+='8'*e

        if(x==3):
            s+='8'
        elif(x==2):
            s+='8'
        elif(x==1):
            s+='8'
        curr=len(s)
        s+='9'*(n-curr)

        s=s[::-1]
        print(int(s))


import re
t=int(input())
for _ in range(t):
    n=int(input())
    if(n==1):
        print(8)
    elif(n==2):
        print(98)
    elif(n==3):
        print(998)
    elif(n==4):
        print(9998)
    else:
        k=4
        s=''
        x=n%k
        e=n//k
        s+='8'*e
        if(x==3):
            s+='4'
        elif(x==2):
            s+='2'
        elif(x==1):
            s+='0'
        curr=len(s)
        s+='9'*(n-curr)
        s=s[::-1]
        print(int(s))


import re
t=int(input())
for _ in range(t):
    n=int(input())
    if(n==1):
        print(8)
    elif(n==2):
        print(98)
    elif(n==3):
        print(998)
    elif(n==4):
        print(9998)
    else:
        k=4
        s=''
        x=n%k
        e=n//k
        s+='8'*e
        print(len(s),x)
        if(x==3):
            s+='8'
        elif(x==2):
            s+='8'
        elif(x==1):
            s+='8'
        curr=len(s)
        s+='9'*(n-curr)
        print(len(s))
        s=s[::-1]
        print(int(s))


t = int(input())
while t>0:
	n = int(input())
	x = "9"
	while len(x)!=n:
		x+="9"
	x = int(x)
	k = ""
	for xx in str(x):
		while xx!="0":
			k = str(int(xx)%2) + k
			xx = str(int(xx)//2)
	r = k[:len(k)-n]
	alg = 0
	if n%4==0:
		x = str(x)
		x = x[:len(x)-(n//4)]
		x+="8"*(n//4)
		x = int(x)
	else:
		if n>4:
			alg+=n//4
		alg+=1
		x = str(x)
		x = x[:len(x)-alg]
		x+="8"*alg
		x = int(x)
	print(x)
	t-=1


t = int(input())
while t>0:
	n = int(input())
	x = "9"
	while len(x)!=n:
		x+="9"
	x = int(x)
	alg = 0
	if n%4==0:
		x = str(x)
		x = x[:len(x)-(n//4)]
		x+="8"*(n//4)
		x = int(x)
	else:
		if n>4:
			alg+=n//4
		alg+=1
		x = str(x)
		x = x[:len(x)-alg]
		x+="8"*alg
		x = int(x)
	print(x)
	t-=1


t = int(input())
while t>0:
	n = int(input())
	x = "9"
	while len(x)!=n:
		x+="9"
	x = int(x)
	k = ""
	for xx in str(x):
		while xx!="0":
			k = str(int(xx)%2) + k
			xx = str(int(xx)//2)
	r = k[:len(k)-n]
	sum = 0
	if n%4==0:
		x = str(x)
		x = x[:len(x)-(n//4)]
		for i in range(n//4):
			x+="8"
		x = int(x)
	else:
		while n%4!=0 and n>0:
			r+="0"
			n-=1
		for j in range(n//4):
			r+="1000"
		nn = 4
		list = []
		for a in r:
			sum += int(a)*(2**(nn-1))
			nn-=1
			if nn == 0:
				nn = 4
				list.append(str(sum))
				sum = 0
		x = "".join(list)
	print(x)
	t-=1


t = int(input())
while t>0:
	n = int(input())
	x = "9"
	while len(x)!=n:
		x+="9"
	x = int(x)
	k = ""
	for xx in str(x):
		while xx!="0":
			k = str(int(xx)%2) + k
			xx = str(int(xx)//2)
	r = k[:len(k)-n]
	sum = 0
	if n%4==0:
		x = str(x)
		x = x[:len(x)-(n//4)]
		for i in range(n//4):
			x+="8"
		x = int(x)
	else:
		if n%4!=0 and n>0:
			r+="0"*(n%4)
			n-=n%4
		if n>0:
			r+="1000"*(n//4)
		nn = 4
		list = []
		for a in r:
			sum += int(a)*(2**(nn-1))
			nn-=1
			if nn == 0:
				nn = 4
				list.append(str(sum))
				sum = 0
		x = "".join(list)
	print(x)
	t-=1


t = int(input())
while t>0:
	n = int(input())
	x = "9"
	while len(x)!=n:
		x+="9"
	x = int(x)
	k = ""
	for xx in str(x):
		while xx!="0":
			k = str(int(xx)%2) + k
			xx = str(int(xx)//2)
	r = k[:len(k)-n]
	sum = 0
	if n%4==0:
		x = str(x)
		x = x[:len(x)-(n//4)]
		for i in range(n//4):
			x+="8"
		x = int(x)
	else:
		if n%4!=0 and n>0:
			r+="0"*(n%4)
			n-=n%4
		if n>0:
			r+="1000"*(n//4)
		nn = 0
		list = []
		for a in range(len(r)//4):
			sum += int(r[nn])*(2**3) + int(r[nn+1])*(2**2) + int(r[nn+2])*2 + int(r[nn+3])*1
			list.append(str(sum))
			sum = 0
			nn+=4
		x = "".join(list)
	print(x)
	t-=1


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *

# from collections import deque
# sys.setrecursionlimit(int(1e3))
# input = stdin.buffer.readline
# print = stdout.write
# dp=[-1]*100000

for __ in range(int(input())):
	n=int(input())
	ans=""
	t=4*n
	t-=n
	m=t%n
	rslt=""
	for i in range(n*4):
		if((i+1)%4==1 or (i+1)%4==0) and i<t:
			ans+="1"
		else:
			ans+="0"

		if(len(ans)==4):
			rslt+=str(int(ans,2))
			ans=""
	# print(ans)
	print(rslt)
	# print(int(ans,2))


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *

# from collections import deque
# sys.setrecursionlimit(int(1e5+5))
input = stdin.buffer.readline
# print = stdout.write
# dp=[-1]*100000
def dfs(s,par):
	global pos
	m1,m2=0,0
	for i in g[s]:
		if(i!=par):
			t1,t2=dfs(i,s)
			m1+=t1
			m2+=t2
	if((p[s]+h[s])%2==1 or (p[s]-h[s])%2==1):
		pos=0
	x=(p[s]+h[s])//2
	y=(p[s]-h[s])//2
	if(m1>x or (x+y)>p[s]):
		pos=0
	return x,y
def df(s,par):
	for i in g[s]:
		if(i!=par):
			p[s]+=df(i,s)
	return p[s]

for __ in range(int(input())):
	n=int(input())
	t=4*n-n
	for i in range(4,4*n+1,4):
		if(i>t):
			print("8",end="")
		else:
			print("9",end="")
	print()


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *

# from collections import deque
# sys.setrecursionlimit(int(1e3))
# input = stdin.buffer.readline
# print = stdout.write
# dp=[-1]*100000

for __ in range(int(input())):
	n=int(input())
	ans=""
	t=4*n-n
	rslt=""
	a=""
	for i in range(n*4):
		if((i+1)%4==1 or (i+1)%4==0) and i<t:
			ans+="1"
			a+="1"
		else:
			ans+="0"
			a+="0"

		if(len(ans)==4):
			if(int(ans,2)==0):
				rslt+="8"
			else:
				rslt+=str(int(ans,2))
			ans=""
	# print(a)
	print(rslt)
	# print(int(ans,2))


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *

# from collections import deque
# sys.setrecursionlimit(int(1e3))
# input = stdin.buffer.readline
# print = stdout.write
# dp=[-1]*100000

for __ in range(int(input())):
	n=int(input())
	ans=""
	t=4*n-n
	rslt=""
	a=""
	for i in range(4,4*n+1,4):
		if(i>t):
			rslt+="8"
		else:
			rslt+="9"
	# print(a)
	print(rslt)
	# print(int(ans,2))


for t in range(int(input())):
    n=int(input())
    val=0
    if (n%4==0): val=n//4
    else: val=n//4 + 1
    print("9"*(n-val)+"8"*val)


for t in range(int(input()):
    n=int(input())
    x="9"*(n-1)+"8"
    print(x)


for t in range(int(input())):
    n=int(input())
    x="9"*(n-1)+"8"
    print(x)


for t in range(int(input())):
    n=int(input())
    val=0
    if (n%4==0): val=n%4
    else val=n%4 + 1
    print("9"*(n-val)+"8"*val)


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	t = n
	while t>4:
		t-=4
		cnt+=1
	for i in range(n-1):
		print("9",end = "")
	print("8",end = "")
	for i in range(cnt-1):
		print("8",end = "")
	print("")


for _ in range(int(input())):
	n = int(input())
	for i in range(n-1):
		print("9",end = "")
	print("8")


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	t = n
	while t>4:
		t-=4
		cnt+=1
	for i in range(n-1-cnt):
		print("9",end = "")
	print("8",end = "")
	for i in range(cnt):
		print("8",end = "")
	print("")


for _ in range(int(input())):
	n = int(input())
	cnt = 0
	t = n
	while t>4:
		t-=4
		cnt+=1
	for i in range(n-1-cnt):
		print("9",end = "")
	print("8",end = "")
	for i in range(cnt-1):
		print("8",end = "")
	print("")


for _ in range(int(input())):
	n=int(input())
	x=n*3
	ans=''
	ans+='9'*(x//4)
	ans+='8'*(n-(x//4))

	print(ans)


for _ in range(int(input())):
	n=int(input())
	s=['1','0','0','1','#']*n
	# print(s)
	for i in range(len(s)-1,-1,-1):
		if(n>0 and s[i]!='#'):
			s[i]='0'
			n-=1
		if(n==0):
			break
	s=''.join(s)
	s=s.split('#')
	ans=''
	# print(s)
	for i in s:
		if i != '':
			temp=0
			count=3
			for j in range(len(i)):
				temp+=int(i[j])*2**count
				count-=1
			ans+=str(temp)
	print(ans)


for _ in range(int(input())):
	n=int(input())
	s=['1','0','0','1','#']*n
	# print(s)
	for i in range(len(s)-1,-1,-1):
		if(n>0 and s[i]!='#'):
			s[i]='0'
			n-=1
		if(n==0):
			break
	s=''.join(s)
	s=s.split('#')
	ans=''
	# print(s)
	for i in s:
		if i != '':
			temp=0
			count=3
			for j in range(len(i)):
				temp+=int(i[j])*2**count
				count-=1
			if(temp)==0:
				temp=8
			ans+=str(temp)
	print(ans)


for _ in range(int(input())):
	n=int(input())
	s=['1','0','0','1','#']*n
	# print(s)
	for i in range(len(s)-1,-1,-1):
		if(n>0 and s[i]!='#'):
			s[i]='0'
			n-=1
		if(n==0):
			break
	s=''.join(s)
	s=s.split('#')
	ans=''
	print(s)
	for i in s:
		if i != '':
			temp=0
			count=3
			for j in range(len(i)):
				temp+=int(i[j])*2**count
				count-=1
			ans+=str(temp)
	print(ans)


import sys
import math
import heapq
import collections
def inputnum():
    return(int(input()))
def inputnums():
    return(map(int,input().split()))
def inputlist():
    return(list(map(int,input().split())))
def inputstring():
    return([x for x in input()])
def inputmatrixchar(rows):
    arr2d = [[j for j in input().strip()] for i in range(rows)]
    return arr2d
def inputmatrixint(rows):
    arr2d = []
    for _ in range(rows):
        arr2d.append([int(i) for i in input().split()])
    return arr2d

t=int(input())
for q in range(t):
    n = inputnum()
    ans = ""
    if n//4 == 4:
        x = n//4
    else:
        x = n//4 + 1
    for i in range(n-x):
        ans += "9"
    for i in range(x):
        ans += "8"
    print(ans)


import sys
import math
import heapq
import collections
def inputnum():
    return(int(input()))
def inputnums():
    return(map(int,input().split()))
def inputlist():
    return(list(map(int,input().split())))
def inputstring():
    return([x for x in input()])
def inputmatrixchar(rows):
    arr2d = [[j for j in input().strip()] for i in range(rows)]
    return arr2d
def inputmatrixint(rows):
    arr2d = []
    for _ in range(rows):
        arr2d.append([int(i) for i in input().split()])
    return arr2d

t=int(input())
for q in range(t):
    n = inputnum()
    if n%4 == 0:
        x = n//4
    else:
        x = n//4 + 1
    ans = "9"*(n-x)
    ans += "8"*x
    print(ans)


import sys
import math
import heapq
import collections
def inputnum():
    return(int(input()))
def inputnums():
    return(map(int,input().split()))
def inputlist():
    return(list(map(int,input().split())))
def inputstring():
    return([x for x in input()])
def inputmatrixchar(rows):
    arr2d = [[j for j in input().strip()] for i in range(rows)]
    return arr2d
def inputmatrixint(rows):
    arr2d = []
    for _ in range(rows):
        arr2d.append([int(i) for i in input().split()])
    return arr2d

t=int(input())
for q in range(t):
    n = inputnum()
    ans = ""
    if n%4 == 0:
        x = n//4
    else:
        x = n//4 + 1
    for i in range(n-x):
        ans += "9"
    for i in range(x):
        ans += "8"
    print(ans)


t=int(input())
for i in range(t):
    n=int(input())
    s="9"*n
    if n%4==0:
        a=(n//4)
        ans=s[:n-a]
        for i in range(a):
            ans+="8"
    else:
        a=(n//4)+1
        ans=s[:n-a]
        for i in range(a):
            ans+="8"
    print(int(ans))


t=int(input())
for i in range(t):
    n=int(input())
    s="9"*n
    if n%4==0:
        a=(n//4)
        ans=s[:n-a]+"8"*a
    else:
        a=(n//4)+1
        ans=s[:n-a]+"8"*a
    print(int(ans))


t=int(input())
for i in range(t):
    n=int(input())
    s=""
    for i in range(n):
        s+="9"
    if n%4==0:
        a=(n//4)
        ans=s[:n-a]
        for i in range(a):
            ans+="8"
    else:
        a=(n//4)+1
        # print(a,n-a)
        ans=s[:n-a]
        # print(ans)
        for i in range(a):
            ans+="8"
    print(int(ans))


import sys

input = sys.stdin.readline

def main(a):
    maxNum = "1001" * a
    num = ""
    maxNum = maxNum[:(-1*a)] + ("0"*a)
    #print(maxNum)
    for i in range(0, len(maxNum), 4):
        num += str(int("0b" + maxNum[i:i+4], 2))
    return num

for _ in range(int(input())):
    a = int(input())
    print(main(a))


import sys

input = sys.stdin.readline

def main(a):
    times, rem = divmod(a, 4)
    num = ""
    if rem > 0:
        num = ("9" * (a - times - 1))  + ("8" * (times+1))
    else:
        num = ("9" * (a - times)) + ("8" * times)
    return num

for _ in range(int(input())):
    a = int(input())
    print(main(a))


import sys

input = sys.stdin.readline

def main(a):
    maxNum = "1001" * a
    num = ""
    maxNum = maxNum[:(-1*a)] + ("0"*a)
    #print(len(maxNum))
    for i in range(0, len(maxNum), 4):
        num += str(int("0b" + maxNum[i:i+4], 2))
    if num[-1] == "0":
        return int(num)-1
    return num

for _ in range(int(input())):
    a = int(input())
    print(main(a))


import sys

input = sys.stdin.readline

def main(a):
    maxNum = "1001" * a
    num = ""
    maxNum = maxNum[:(-1*a)] + ("0"*a)
    #print(len(maxNum))
    for i in range(0, len(maxNum), 4):
        if maxNum[i:i+4] == "0000":
            num += str(8)
        else:
            num += str(int("0b" + maxNum[i:i+4], 2))
    if num[-1] == "0":
        return int(num)-1
    return num

for _ in range(int(input())):
    a = int(input())
    print(main(a))


import sys

input = sys.stdin.readline

def main(a):
    maxNum = ["1001"] * a
    num = ""

    times, rem = divmod(a, 4)
    if times == 0:
      maxNum[-1] = maxNum[-1][:-1 * rem] + ("0"*rem)
    elif rem == 1:
        maxNum = maxNum[:-1*times]
        maxNum[-1] = maxNum[-1][:3] + "0"
        maxNum += maxNum + (["0000"] * times)
    else:
        maxNum = maxNum[:-1*times]
        maxNum += maxNum + (["0000"] * times)
    for i in maxNum:
        num += str(int("0b" + i, 2))
    return num

for _ in range(int(input())):
    a = int(input())
    print(main(a))


import math
for i in range(int(input())):
    n = int(input())
    t = math.ceil(n/4)
    print((n-t)*'9' + t*'8')


for i in range(int(input())):
    n = int(input())
    print((n-1)*'9' + '8')


for i in range(int(input())):
    n = int(input())
    t = n//4 + 1
    print((n-t)*'9' + t*'8')