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

using ll = long long;
using pi = pair<int, int>;
const int nax = 3e5 + 5;

vector<int> arr(nax), l(nax), r(nax), maxrange(nax); // next smaller in left and right side

int main() {
	int t, n;
	cin >> t;
	while (t--) {
		cin >> n;
		arr[0] = arr[n + 1] = n+1;
		for (int i = 1; i <= n; i++) {
			cin >> arr[i];
			maxrange[i] = 0;
		}
		stack<int> s;
		s.push(0);
		for (int i = 1; i <= n; i++) {
			while (!s.empty() && arr[s.top()] >= arr[i]) {
				s.pop();
			}
			if (s.empty()) l[i] = 1;
			else l[i] = s.top() + 1;
			s.push(i);
		}
		while (!s.empty()) {
			s.pop();
		}
		s.push(n + 1);
		for (int i = n; i >= 1; i--) {
			while (!s.empty() && arr[s.top()] >= arr[i]) {
				s.pop();
			}
			if (s.empty()) r[i] = n;
			else r[i] = s.top() - 1;
			s.push(i);
		}
		for (int i = 1; i <= n; i++) {
			maxrange[arr[i]] = max(maxrange[arr[i]], r[i] - l[i] + 1);
		}
		string str;
		int mn = n;
		for (int i = 1; i <= n; i++) {
			mn = min(mn, maxrange[i]);
			if (mn == n - i + 1) str += '1';
			else str += '0';
		}
		reverse(str.begin(), str.end());
		cout << str << '\n';
	}
	return 0;
}

