#include<bits/stdc++.h>

using namespace std;
const int maxn = 5e5+10;

int ans[maxn],a[maxn],cnt[maxn];

int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        memset(ans,0,sizeof(ans));
        memset(cnt,0,sizeof(cnt));
        for(int i = 1;i <= n;i ++)
        {
            scanf("%d",&a[i]);
            cnt[a[i]]++;
        }
        bool flag = 1;
        for(int i = 1;i <= n;i ++)
        {
            if(cnt[i] > 1) flag = 0;
        }
        if(flag) ans[1] = 1;
        if(cnt[1]) ans[n] = 1;
        int l = 1,r = n,cur = 1;
        for(int i = n - 1;i >= 2;i --)
        {
            if(cnt[cur+1]&&cnt[cur]==1&&(a[l]==cur||a[r]==cur))
            {
                ans[i]=1;
                if(a[l]==cur)
                    l++;
                else
                    r--;
                cur ++;
            }
            else break;
        }
        for(int i = 1;i <= n;i ++) printf("%d",ans[i]);
        puts("");
    }
}
