#include<bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include"custom_header.h"
#else
#define openfile 
#endif
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define ll long long
#define ld long double
#define fo(i,v,e) for(v=i;v<e;v++)
#define rfo(i,v,e) for(v=i;v>e;v--)
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define vl vector<ll>
#define sz(x) (ll)x.size()
#define vvl vector<vl>
#define vpl vector<pll>
const ll mod = 1000000007;
void solve()
{
    ll n,i,j;cin>>n;
    vl mx(n+1,0);
    vector<long long> A(n),left(n),right(n);
    for(int i=0; i<n; i++)
    {
        cin>>A[i];
    }
    stack<pair<ll,ll>> s;
    s.push({0,-1});
    for(int i = 0; i < n;i++)
    {
        while(s.top().first >= A[i])
            s.pop();
        left[i] = s.top().second;
        s.push({A[i],i});
    }
    while(!s.empty())
        s.pop();
    s.push(make_pair(0, n));
    for(int i = n-1 ; i>=0 ; i--)
    {
        while(s.top().first >= A[i])
            s.pop();
        right[i] = s.top().second;
        s.push({A[i],i});
    }
    for(int i=0; i < n; i++)
    {
      mx[A[i]] = max(mx[A[i]],right[i]-left[i]-1);
    }
    vector<bool>fans(n+1,false);
    ll ans = n;
    rfo(n,i,0)
    {
       ans = min({ans,mx[n-i+1],i});
       if(ans==i)
       {
          fans[i]=true;
       }
    }
    fo(1,i,n+1)
    {
       cout<<(fans[i]?'1':'0');
    }
    cout<<endl;
}
int main()
{
    openfile;fastio;
    ll T = 1; 
    cin>>T;
    while(T--)
    {solve();}
}