#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(), x.end()
#define chmax(x, a) x = max(x, a);
#define chmin(x, a) x = min(x, a);

int main() {
    FASTIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> cnt(n), pos(n);
        vector<bool> ans(n, 0);
        for (int i = 0; i < n; i++) {
            int tmp;
            cin >> tmp;
            tmp--;
            cnt[tmp]++;
            pos[tmp] = i;
        }
        if (cnt == vector<int>(n, 1)) {
            ans[0] = 1;
        }
        int l = 0, r = n-1, k = 0;
        while (k < n - 1 && cnt[k] == 1 && (pos[k] == l || pos[k] == r)) {
            if (pos[k] == l) {
                l++;
            } else {
                r--;
            }
            k++;
        }
        for (int i = ans.size() - k; i < ans.size(); i++) {
            ans[i] = 1;
        }
        if (cnt[k] > 0) {
            ans[ans.size()-k-1] = 1;
        }
        for (auto o : ans) {
            cout << o;
        }
        cout << "\n";
    }
}
 