#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    vector<int> sq;
    for (int i = 1; i < 708; i++) {
        sq.push_back(i*i);
    }
    bool b;
    int n, a;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        b = 0;
        for (int j = 0; j < sq.size() && sq[j] < a; j++) {
            int l = 0, r = sq.size()-1, ca = a-sq[j];
            while (l < r-1) {
                int x = l + (r-l)/2;
                if (sq[x] > ca) {
                    r = x;
                }
                else if (sq[x] < ca) {
                    l = x;
                }
                else {
                    b = 1;
                    break;
                }
            }
            if (b == 1) {
                break;
            }
        }
        cout << b;
    }
    return 0;
}
