#include <bits/stdc++.h>
#define IOS (ios::sync_with_stdio(false),cin.tie(0),cout.tie(0))
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define fa(i,j,n) for(int i=j;i<n;i++)
#define fb(i,j,n) for(int i=j;i<=n;i++)
#define fc(i,j,n) for(int i=j;i>n;i--)
#define fd(i,j,n) for(int i=j;i>=n;i--)

using namespace std;

const int N = 3e5+5;
int t,n,m;
int a[N];
int s[N];
int l[N];
int r[N];
int mp[N];
int main() {
    IOS;
//    freopen("input.txt","r",stdin);
    cin>>t;
    while(t--) {
        cin>>n;
        fb(i,1,n) {
            cin>>a[i];
        }
        int p=0;
        s[p]=0;
        fb(i,1,n) {
            while( p && a[i] <= a[ s[p] ])
                p--;
            l[i]=s[p]+1;
            s[++p]=i;
        }
        p=0;
        s[p]=n+1;
        fd(i,n,1) {
            while( p && a[i] <= a[ s[p] ])
                p--;
            r[i]=s[p]-1;
            s[++p]=i;
        }
        memset(mp,0,sizeof mp);
        mp[0]=INF;
        fb(i,1,n) {
            mp[ a[i] ]=max( mp[ a[i] ],r[i]-l[i]+1 );
        }
        vi ve;
        int minn=-INF;
        fb(i,1,n) {
            if(mp[i]==0){
                int j=i;
                fb(j,i,n){
                    ve.push_back(0);
                }
                break;
            }
            if(mp[i]>=n-i+1 && minn<=0)
                ve.push_back(1);
            else
                ve.push_back(0);
            minn=max(minn,n-i+1-mp[i]);
            minn--;
        }
        fd(i,ve.size()-1,0){
            cout<<ve[i];
        }
        cout<<endl;
    }
    return 0;
}
