#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
    int n, br=1;
    char niz[8000], str[8000];
    cin>>n;
    for (int i=0; i<=n-1; i++)
    {
        cin>>niz;
        int len=strlen(niz);
        for (int j=1; j<=len; j++)
        {
            if (niz[j]==niz[i])
            {
                br++;
            }
        }
        if (niz[0]==niz[len-1])
        {
            str[i]='1';
            br=0;
        }
        else
        {
            if (len%2==0)
            {
                if (br%2==1)
                {
                    str[i]='1';
                    br=0;
                }
                if (br%2==0)
                {
                    str[i]='0';
                    br=0;
                }
            }
            if (len%2==1)
            {
                if (br%2==1)
                {
                    str[i]='0';
                    br=0;
                }
                if (br%2==0)
                {
                    str[i]='1';
                    br=0;
                }
            }
        }
    }
    cout<<str;
    return 0;
}
