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