#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
# define ll  long long int
# define ld  long double
# define pb push_back
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 3e5;
int fre[N + 1], poss[N + 1], arr[N + 5];

void solve(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        fre[i] = 0;
        poss[i] = 0;
    }
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
        fre[arr[i]]++;
    }
    // Special case:
    // k = 1
    int disntinct = 0;
    for(int i = 1; i <= n; i++)
        if(fre[i] == 1)
            disntinct++;
    if(disntinct == n)
        poss[1] = 1;

    int l = 1, r = n;
    for(int k = n; k > 1; k--){
        int req = n - k + 1;
        if(fre[req] == 0)
            break;
        poss[k] = 1;
        if(fre[req] != 1){
            break;
        }
        else{
            if(arr[l] == req){
                l++;
            }
            else if(arr[r] == req)
                r--;
            else
                break;
            poss[k] = 1;
        }

    }
    for(int i = 1; i <= n; i++)
        cout << poss[i];
    cout << "\n";
}

int main()
{
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif
     IOS
     int t = 1;
     cin >> t;
     while(t--){
        solve();
        // cout << fixed << setprecision(7); //For trailing 0's
     }
    return 0;
}