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

#define ll long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define re reverse
#define ps push
#define in insert
#define fr front
#define f first
#define s second
#define sv(v) shuffle(all(v), default_random_engine())
#define sa(a, n) shuffle(a, a+n, default_random_engine())
#define ca(v) for(auto i:v) cout<<i<<" ";
#define nl cout<<"\n"
#define del(s, x) s.erase(s.find(x))
#define delend(s) s.erase(--s.end())
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a*b/gcd(a, b))
#define debug cout<<"DEBUG\n"
int xm[4] = {-1, 1, 0, 0};
int ym[4] = {0, 0, -1, 1};
const int MOD = 1e9 + 7;
const int MAXN = 5e5 + 5;

int ans[MAXN];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int ar[n];
        for(int i=0; i<n; i++) { cin>>ar[i]; ans[i] = 0; }
        ans[n] = 0;
        set<int> vals[n+1];
        
        for(int i=0; i<n; i++){
            vals[ar[i]].in(i);
        }
        int l = -1; int r = n;
        for(int i=1; i<=n; i++){
            if(vals[i].size()==0) break;
            ans[n+1-i] = 1;
            if(vals[i].size()>1) break;
            if(*vals[i].begin() == l+1){
                l++;
                continue;
            }
            if(*vals[i].rbegin() == r-1){
                r--;
                continue;
            }
            break;
        }
        int cnt = 0;
        for(int i=1; i<=n; i++){
            if(vals[i].size()>0) cnt++;
        }
        if(cnt==n) ans[1] = 1;
        for(int i=1; i<=n; i++) cout<<ans[i];
        nl;
    }
}

