#include<stdio.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
while(n--){
int m;
scanf("%d",&m);
if(m==0) printf("0");
else{
int k=0,b[100];
while(m!=0){
b[k++]=m%2;
m/=2;
}
int i=k-1;
while(b[i]==0) i--;
for(int j=i;j>=0;j--){
printf("%d",b[j]);
}
}
printf("\n");
}
}
return 0;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
while(n--){
int m;
scanf("%d",&m);
if(m==0) printf("0");
else{
int k=0,b[100];
while(m!=0){
b[k++]=m%2;
m/=2;
}
int i=k-1;
while(b[i]==0) i--;
for(int j=i;j>=0;j--){
printf("%d",b[j]);
}
}
printf("\n");
}
}
return 0;
}