#include<iostream>
#include<cstring>
using namespace std;
char d[1000][8000];
long long n;
long long buk[52];
long long odds=0;
int main()
{
    cin>>n;
    for(long long i=0;i<n;i++)
    {
        cin>>d[i];
    }

    for(long long i=0;i<n;i++)
    {
        odds=0;
        for(long long j=0;j<52;j++)
        {
            buk[j]=0;
        }
        for(long long j=0;j<8000;j++)
        {
            if(d[i][j]=='\0')
            {
                break;
            }
            if(d[i][j]>='A' && d[i][j]<='Z')
            {
                buk[d[i][j]-'A']++;
            }
            else if(d[i][j]>='a' && d[i][j]<='z')
            {
                buk[d[i][j]-'a'+27]++;
             //   cout<<buk[d[i][j]-'a'+27]<<" ";
            }
        }
        for(long long j=0;j<52;j++)
        {
            //  cout<<buk[j]<<" ";
            if(buk[j]%2==1)
            {
             ///   cout<<buk[j]<<" ";
               /// cout<<"S ";
                odds++;
            }
        }
        if(odds>1)
        {
            cout<<"0";
        }
        else
        {
            cout<<"1";
        }
    }
    return 0;
}
