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

const int MAXN = 3e5 + 10;

int N;
int A[MAXN];
int B[MAXN];

int ans[MAXN];

bool is_permutation() {
  sort(B + 1, B + 1 + N);
  for (int i = 1; i <= N; ++i)
    if (B[i] != i)
      return false;
  return true;
}

void solve(bool has_one) {
  for (int i = 1; i <= N; ++i) ans[i] = 0;

  if (!has_one) return;

  map<int, int> freq;
  for (int i = 1; i <= N; ++i) ++freq[A[i]];

  int L = 1;
  int R = N;
  int cur;
  for (cur = 1; cur <= N; ++cur) {
    if (freq[cur] != 1) break;
    if (A[L] == cur) ++L;
    else if (A[R] == cur) --R;
    else break;
  }

  if (is_permutation()) ans[1] = 1;

  if (L > R) {
    for (int k = 2; k <= N; ++k) ans[k] = 1;
    return;
  }
  int len = R - L + 1;
  if (!freq[cur]) ++len;
  for (int k = len; k <= N; ++k) ans[k] = 1;
}

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int t; cin >> t;
  while (t--) {
    cin >> N;
    bool has_one = false;
    for (int i = 1; i <= N; ++i) {
      cin >> A[i];
      B[i] = A[i];
      if (A[i] == 1) has_one = true;
    }
    solve(has_one);
    for (int i = 1; i <= N; ++i) cout << ans[i];
    cout << "\n";
  }
  return 0;
}