#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define ld long double
#define vi vector<vector<ll> >
#define deb(x) cout<<x<<"\n";
using namespace std;
const int MOD=1000000007;
const int MOD2=15000007;
const ll MAX=9187201950435737471;
const int N=100005;
const ll INF=1e17;
const long double PI=acos(-1);

ll po(ll x,ll y){
    ll ret=1;
    while(y>0){
        if(y&1){
            ret=(ret*x);
        }
        y=y>>1ll;
        x=(x*x);
    }
    return ret;
}

bool ok[300005];
int n;
int a[300005];


bool f(int k){
    memset(ok,false ,sizeof ok);
    if(k>n)return 1;
    deque<pair<int,int> >q;
    for(int i=0;i<k;i++){
        while(!q.empty() && q.front().fi>a[i]){
            q.pop_front();
        }
        q.push_front({a[i],i});
    }
    ok[q.back().fi]=1;
    for(int i=k;i<n;i++){
        while(!q.empty() && q.front().fi>a[i]){
            q.pop_front();
        }
        while(!q.empty() && q.back().se<=i-k){
            q.pop_back();
        }
        q.push_front({a[i],i});
        ok[q.back().fi]=1;
    }
    for(int i=1;i<=n-k+1;i++){
        if(!ok[i])return 0;
    }
    return 1;
}

void solve(int T){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int st=2,en=n+1,ret=n;
    while(st<=en){
        int md=(st+en)/2;
        if(f(md)){
            ret=md;
            en=md-1;
        }
        else {
            st=md+1;
        }
    }
    cout<<f(1);
    for(int i=2;i<=n;i++){
        if(i<ret)cout<<0;
        else {
            cout<<1;
        }
    }
    cout<<"\n";
}

int main() {
    //freopen("","r",stdin);
    //freopen("output.txt","w",stdout);
    fastio
    int T=1;
    cin>>T;
    for(int i=1;i<=T;i++){
        solve(i);
        //if(i<T)cout<<"\n";
    }
    return 0;
}

//int tt=qu(1,0,n-1,i+1,j-1);
