#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 3e5+10;
const LL mod = 1e9+7;

int t, n, a[maxn], b[maxn], c[maxn], tr[maxn*4], ans;
char d[maxn];

void build(int num, int l, int r) {
	if (l == r) {
		tr[num] = a[l];
		return;
	}
	build(num*2, l, (l+r)/2);
	build(num*2+1, (l+r)/2+1, r);
	tr[num] = min(tr[num*2], tr[num*2+1]);
}

int query(int num, int l, int r, int x, int y) {
	if (x <= l && r <= y) {
		return tr[num];
	}
	if (x > r || l > y) {
		return n+1;
	}
	return min(query(num*2, l, (l+r)/2, x, y), query(num*2+1, (l+r)/2+1, r, x, y));
}

int chk(int x) {
	if (x == 1) {
		return 0;
	}
	for (int i = 1; i <= n-x+1; i++) {
		c[i] = 0;
	}
	int f = 0;
	for (int i = 1; i <= n-x+1; i++) {
		b[i] = query(1, 1, n, i, i+x-1);
		if (b[i] > n-x+1 || c[b[i]]) {
			return 0;
		}
		c[b[i]]++;
		if (i >= 2 && b[i] < b[i-1]) {
			f = 1;
		}
		if (i >= 2 && b[i] > b[i-1] && f) {
			return 0;
		}
	}
	return 1;
}

int main()
{
	cin >> t;
	while (t--) {
		cin >> n;
		for (int i = 1; i <= n; i++) {
			b[i] = 0;
		}
		int f = 1;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			if (b[a[i]]) {
				f = 0;
			}
			b[a[i]]++;
		}
		d[1] = f+'0';
		build(1, 1, n);
		int l = 2, r = n, m;
		while (l <= r) {
			m = (l+r)/2;
			if (chk(m)) {
				r = m-1;
			} else {
				l = m+1;
			}
		}
		for (int i = 2; i <= n; i++) {
			if (i >= l) {
				d[i] = '1';
			} else {
				d[i] = '0';
			}
		}
		d[n+1] = '\0';
		cout << d+1 << endl;
	}
	return 0;
}
