#include <bits/stdc++.h>
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;

        vector <int> s(256);
        int br = 0;

        for (char& sym : str) s[sym]++;
        for (int j = 0; j < 256; j++) {
            if (s[j] % 2 != 0) br++;
        }

        if (br < 2) cout << 1;
        else cout << 0;
    }

    cout << endl;
    return 0;

}
/// 3 abcabc xyz rotor
