#include <iostream>
#include <string>
#include <math.h>
#define uint unsigned int
void p(int counter,long long x,long long s)
{
if(s == 1)
{
long long a = long long(pow(double(-1),counter));
if(a == 1)
std::cout << '1';
else
std::cout << '0';
}
else
p(counter+1,x - s/2,pow(2,ceil(log(double(x - s/2))/log(double(2)))));
}
int main()
{
int count;
std::cin >> count;
for(int a = 0;a < count;a++)
{
long long this_int;
std::cin >> this_int;
double closest = pow(2,ceil(log(double(this_int))/log(double(2))));
p(1,this_int,closest);
if(a != count - 1)
std::cout << '\n';
}
return 0;
}