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

#define int long long
#define double long double

#define x first
#define y second

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        vector< int > v(n);

        string ans = "";

        vector< int > freq(n+1);

        for(int i = 0; i < n; i++){
            cin >> v[i];
            freq[v[i]]++;
        }

        vector< int > z(v);
        sort(z.begin(), z.end());

        bool verif = false;

        for(int i = 0; i < n; i++){
            if(z[i] != i+1){
                verif = true;
                break;
            }
        }
        
        if(!verif) ans+= '1';
        else ans += '0';

        bool good = true;
        int l = 0;
        int r = n-1;
        for(int i = 1; i <= n-2; i++){
            if(good){

                if(freq[i] != 1){
                    good = false;
                }else if(freq[i+1] == 0){
                    good = false;
                }else if(v[l] == i){
                    l++;
                }else if(v[r] == i){
                    r--;
                }else{
                    good = false;
                }

            }
            if(good){
                ans += '1';
            }else{
                ans += '0';
            }
        }


        int mini = numeric_limits<int>::max();

        for(int i = 0; i < n; i++){
            mini = min(mini, v[i]);
        }
        if(mini == 1 && n>1){
            ans += '1';
        }else if(n > 1){
            ans += '0';
        }

        reverse(ans.begin()+1, ans.end()-1);
        cout << ans << endl;
    }
}
/*
1
5
11 0
7 3
9 5
6 7
0 3
*/
