#include <stdio.h>

void judge(int num)
{
    int num0=0,num1=0,op,number=9;
    while(num)
    {
        op=num%2;
        if(op==0) num0++;
        else num1++;
        num/=2;
    }
    num0%=2;num1%=2;
    if(num1==0&&num0!=0) number=1;
    else if(num0==0&&num1!=0) number=0;
    else if(num1==0&&num0==0) number=10;
    else number=100;
    printf("%d ",number);
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int num=0;
        scanf("%d",&num);
        judge(num);
    }
}