#include<stdio.h>
int main(void)
{
    int i,j,k,t,l,x,z1,z2,last,m,n,p1,p2,max,count;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        int array[n],extra[n];
        char string[n+3];
        string[0]='1';
        string[n-1]='1';
        count=2;
        for(j=0,m=0,last=0;j<n;j++)
        {
            scanf("%d",&array[j]);
            extra[j]=j;
            if(array[j]==1)
            {
                m=1;
                x=j;
                if(j-1>=0)
                    k=j-1;
                else
                    k=-1;
                if(j+1<n)
                    l=j+1;
                else
                    l=-1;
            }
            else if(m&&j>x)
            {
                extra[count-1]-=last;
                for(z1=0,z2=0;;)
                {
                    if(array[k]<=count&&!z1)
                    {
                        extra[count-1]--;
                        if(k-1>=0)
                            k--;
                        else if(!k)
                            z1=1;
                    }
                    else
                        z1=1;
                    if(z1&&z2)
                        break;
                    if(!extra[count-1])
                        break;
                    if(array[l]<=count&&!z2)
                    {
                        extra[count-1]--;
                        if(l+1<n)
                            l++;
                        else if(l==n-1)
                            z2=1;
                    }
                    else
                        z2=1;
                    if(z1&&z2)
                        break;
                    if(!extra[count-1])
                        break;
                }
                if(!extra[count-1])
                {
                    string[count-1]='1';
                    last=count-1;
                }
                else
                    string[count-1]='0';
                count++;
            }
        }
        while(count<n)
        {
            extra[count-1]-=last;
            for(z1=0,z2=0;;)
            {
                if(array[k]<=count&&!z1)
                {
                    extra[count-1]--;
                    if(k-1>=0)
                        k--;
                    else if(!k)
                        z1=1;
                }
                else
                    z1=1;
                if(z1&&z2)
                    break;
                if(!extra[count-1])
                    break;
                if(array[l]<=count&&!z2)
                {
                    extra[count-1]--;
                    if(l+1<n)
                        l++;
                    else if(l==n-1)
                        z2=1;
                }
                else
                    z2=1;
                if(z1&&z2)
                    break;
                if(!extra[count-1])
                    break;
            }
            if(!extra[count-1])
            {
                string[count-1]='1';
                last=count-1;
            }
            else
                string[count-1]='0';
            count++;
        }
        string[n]='\0';
        printf("%s\n",string);
    }
}


#include<stdio.h>
int main(void)
{
    int i,j,k,t,l,x,z1,z2,last,m,n,p1,p2,max,count;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        int array[n],extra[n];
        char string[n+3];
        string[0]='1';
        string[n-1]='1';
        count=2;
        for(j=0,m=0,last=0;j<n;j++)
        {
            scanf("%d",&array[j]);
            extra[j]=j;
            if(array[j]==1)
            {
                m=1;
                x=j;
                if(j-1>=0)
                    k=j-1;
                else
                    k=-1;
                if(j+1<n)
                    l=j+1;
                else
                    l=-1;
            }
            else if(m&&j>x)
            {
                if(!extra[count-2])
                    extra[count-1]-=(count-2);
                else
                    extra[count-1]-=(count-2-extra[count-2]);
                for(z1=0,z2=0;;)
                {
                    if(array[k]<=count&&!z1)
                    {
                        extra[count-1]--;
                        if(k-1>=0)
                            k--;
                        else if(!k)
                            z1=1;
                    }
                    else
                        z1=1;
                    if(z1&&z2)
                        break;
                    if(!extra[count-1])
                        break;
                    if(array[l]<=count&&!z2)
                    {
                        extra[count-1]--;
                        if(l+1<n)
                            l++;
                        else if(l==n-1)
                            z2=1;
                    }
                    else
                        z2=1;
                    if(z1&&z2)
                        break;
                    if(!extra[count-1])
                        break;
                }
                if(!extra[count-1])
                {
                    string[count-1]='1';
                    last=count-1;
                }
                else
                    string[count-1]='0';
                count++;
            }
        }
        while(count<n)
        {
            if(!extra[count-2])
                extra[count-1]-=(count-2);
            else
                extra[count-1]-=(count-2-extra[count-2]);
            for(z1=0,z2=0;;)
            {
                if(array[k]<=count&&!z1)
                {
                    extra[count-1]--;
                    if(k-1>=0)
                        k--;
                    else if(!k)
                        z1=1;
                }
                else
                    z1=1;
                if(z1&&z2)
                    break;
                if(!extra[count-1])
                    break;
                if(array[l]<=count&&!z2)
                {
                    extra[count-1]--;
                    if(l+1<n)
                        l++;
                    else if(l==n-1)
                        z2=1;
                }
                else
                    z2=1;
                if(z1&&z2)
                    break;
                if(!extra[count-1])
                    break;
            }
            if(!extra[count-1])
            {
                string[count-1]='1';
                last=count-1;
            }
            else
                string[count-1]='0';
            count++;
        }
        string[n]='\0';
        printf("%s\n",string);
    }
}


process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  const t = parseInt(arr.shift())

  for(let j = 0; j < t; j++) {
    const n = parseInt(arr[2 * j])
    let min, max, s = new Array(n)
    let pos = {}
    const arrN = arr[2 * j +  1].split(' ').map((a, i) => {
      a = parseInt(a)
      pos[a] = i
      return parseInt(a)
    })
    max = min = pos[1]
    s[0] = s[n - 1] = 1

    for(let i = 1, num = 2; i < n - 1; i++, num ++) {
      max = Math.max(max, pos[num])
      min = Math.min(min, pos[num])
      if(max - min + 1  == num) s[i] = 1
      else s[i] = 0
    }

    console.log(s.join(''))
  }
})


using System;
using System.IO;
using System.Linq;
using CompLib.Util;
using System.Threading;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false});
        int t = sc.NextInt();
        for (int i = 0; i < t; i++)
        {
            Q(sc);
        }

        Console.Out.Flush();
    }

    void Q(Scanner sc)
    {
        int n = sc.NextInt();
        int[] p = sc.IntArray();

        int[] index = new int[n + 1];
        for (int i = 0; i < n; i++)
        {
            index[p[i]] = i;
        }

        int left = int.MaxValue;
        int right = int.MinValue;

        int[] ans = new int[n];
        for (int i = 1; i <= n; i++)
        {
            left = Math.Min(left, index[i]);
            right = Math.Max(right, index[i]);

            int len = right - left + 1;
            ans[i - 1] = i == len ? 1 : 0;
        }

        Console.WriteLine(string.Join("", ans));
    }

    public static void Main(string[] args) => new Program().Solve();
    // public static void Main(string[] args) => new Thread(new Program().Solve, 1 << 27).Start();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CodeforcesRound604Div2.Questions;

namespace CodeforcesRound604Div2.Questions
{
    public class QuestionB : AtCoderQuestionBase
    {
        [MethodImpl(MethodImplOptions.AggressiveOptimization)]
        public override void Solve(IOManager io)
        {
            var tests = io.ReadInt();

            for (int t = 0; t < tests; t++)
            {
                var n = io.ReadInt();
                var p = new int[n];

                for (int i = 0; i < p.Length; i++)
                {
                    p[i] = io.ReadInt() - 1;
                }

                var indice = new int[n];

                for (int i = 0; i < indice.Length; i++)
                {
                    indice[p[i]] = i;
                }

                var uf = new UnionFind(n);
                var result = new char[n];

                for (int i = 0; i < indice.Length; i++)
                {
                    var current = indice[i];

                    if (current > 0 && p[current - 1] < p[current])
                    {
                        uf.Unite(current - 1, current);
                    }

                    if (current + 1 < p.Length && p[current + 1] < p[current])
                    {
                        uf.Unite(current + 1, current);
                    }

                    if (uf.GetGroupSizeOf(current) == i + 1)
                    {
                        result[i] = '1';
                    }
                    else
                    {
                        result[i] = '0';
                    }
                }

                io.WriteLine(string.Concat(result));
            }
        }

        public class UnionFind
        {
            private int[] _parentsOrSizes;
            public int Count => _parentsOrSizes.Length;
            public int Groups { get; private set; }

            public UnionFind(int count)
            {
                _parentsOrSizes = new int[count];
                _parentsOrSizes.AsSpan().Fill(-1);
                Groups = _parentsOrSizes.Length;
            }

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public bool Unite(int a, int b)
            {
                var x = FindRoot(a);
                var y = FindRoot(b);

                if (x == y)
                {
                    return false;
                }
                else
                {
                    if (-_parentsOrSizes[x] < _parentsOrSizes[y])
                    {
                        (x, y) = (y, x);
                    }

                    _parentsOrSizes[x] += _parentsOrSizes[y];
                    _parentsOrSizes[y] = x;
                    Groups--;
                    return true;
                }
            }

            public bool IsInSameGroup(int a, int b) => FindRoot(a) == FindRoot(b);

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            public int FindRoot(int index)
            {
                if (unchecked((uint)index >= (uint)_parentsOrSizes.Length))
                {
                    ThrowArgumentException();
                }

                return FindRecursive(index);

                int FindRecursive(int index)
                {
                    if (_parentsOrSizes[index] < 0)
                    {
                        return index;
                    }
                    else
                    {
                        return _parentsOrSizes[index] = FindRecursive(_parentsOrSizes[index]);
                    }
                }
            }

            public int GetGroupSizeOf(int index) => -_parentsOrSizes[FindRoot(index)];

            public int[][] GetAllGroups()
            {
                var resultIndices = ArrayPool<int>.Shared.Rent(_parentsOrSizes.Length);
                var index = 0;
                var results = new int[Groups][];

                for (int i = 0; i < _parentsOrSizes.Length; i++)
                {
                    if (_parentsOrSizes[i] < 0)
                    {
                        results[index] = new int[-_parentsOrSizes[i]];
                        resultIndices[i] = index++;
                    }
                }

                var counts = new int[results.Length];

                for (int i = 0; i < _parentsOrSizes.Length; i++)
                {
                    var group = resultIndices[FindRoot(i)];
                    results[group][counts[group]++] = i;
                }

                ArrayPool<int>.Shared.Return(resultIndices);

                return results;
            }

            private void ThrowArgumentException() => throw new ArgumentException();
        }
    }
}

namespace CodeforcesRound604Div2
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionB();
            using var io = new IOManager(Console.OpenStandardInput(), Console.OpenStandardOutput());
            question.Solve(io);
        }
    }
}

#region Base Class

namespace CodeforcesRound604Div2.Questions
{
    public interface IAtCoderQuestion
    {
        string Solve(string input);
        void Solve(IOManager io);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public string Solve(string input)
        {
            var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(input));
            var outputStream = new MemoryStream();
            using var manager = new IOManager(inputStream, outputStream);

            Solve(manager);
            manager.Flush();

            outputStream.Seek(0, SeekOrigin.Begin);
            var reader = new StreamReader(outputStream);
            return reader.ReadToEnd();
        }

        public abstract void Solve(IOManager io);
    }
}

#endregion

#region Utils

namespace CodeforcesRound604Div2
{
    public class IOManager : IDisposable
    {
        private readonly BinaryReader _reader;
        private readonly StreamWriter _writer;
        private bool _disposedValue;
        private byte[] _buffer = new byte[1024];
        private int _length;
        private int _cursor;
        private bool _eof;

        const char ValidFirstChar = '!';
        const char ValidLastChar = '~';

        public IOManager(Stream input, Stream output)
        {
            _reader = new BinaryReader(input);
            _writer = new StreamWriter(output) { AutoFlush = false };
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private char ReadAscii()
        {
            if (_cursor == _length)
            {
                _cursor = 0;
                _length = _reader.Read(_buffer);

                if (_length == 0)
                {
                    if (!_eof)
                    {
                        _eof = true;
                        return char.MinValue;
                    }
                    else
                    {
                        ThrowEndOfStreamException();
                    }
                }
            }

            return (char)_buffer[_cursor++];
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public char ReadChar()
        {
            char c;
            while (!IsValidChar(c = ReadAscii())) { }
            return c;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public string ReadString()
        {
            var builder = new StringBuilder();
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                builder.Append(c);
            } while (IsValidChar(c = ReadAscii()));

            return builder.ToString();
        }

        public int ReadInt() => (int)ReadLong();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long ReadLong()
        {
            long result = 0;
            bool isPositive = true;
            char c;

            while (!IsNumericChar(c = ReadAscii())) { }

            if (c == '-')
            {
                isPositive = false;
                c = ReadAscii();
            }

            do
            {
                result *= 10;
                result += c - '0';
            } while (IsNumericChar(c = ReadAscii()));

            return isPositive ? result : -result;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private Span<char> ReadChunk(Span<char> span)
        {
            var i = 0;
            char c;
            while (!IsValidChar(c = ReadAscii())) { }

            do
            {
                span[i++] = c;
            } while (IsValidChar(c = ReadAscii()));

            return span.Slice(0, i);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public double ReadDouble() => double.Parse(ReadChunk(stackalloc char[32]));

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public decimal ReadDecimal() => decimal.Parse(ReadChunk(stackalloc char[32]));

        public int[] ReadIntArray(int n)
        {
            var a = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadInt();
            }
            return a;
        }

        public long[] ReadLongArray(int n)
        {
            var a = new long[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadLong();
            }
            return a;
        }

        public double[] ReadDoubleArray(int n)
        {
            var a = new double[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDouble();
            }
            return a;
        }

        public decimal[] ReadDecimalArray(int n)
        {
            var a = new decimal[n];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = ReadDecimal();
            }
            return a;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteLine<T>(T value) => _writer.WriteLine(value.ToString());

        public void WriteLine<T>(IEnumerable<T> values, char separator)
        {
            var e = values.GetEnumerator();
            if (e.MoveNext())
            {
                _writer.Write(e.Current.ToString());

                while (e.MoveNext())
                {
                    _writer.Write(separator);
                    _writer.Write(e.Current.ToString());
                }
            }

            _writer.WriteLine();
        }

        public void WriteLine<T>(Span<T> values, char separator) => WriteLine((ReadOnlySpan<T>)values, separator);

        public void WriteLine<T>(ReadOnlySpan<T> values, char separator)
        {
            for (int i = 0; i < values.Length - 1; i++)
            {
                _writer.Write(values[i]);
                _writer.Write(separator);
            }

            if (values.Length > 0)
            {
                _writer.Write(values[^1]);
            }

            _writer.WriteLine();
        }

        public void Flush() => _writer.Flush();

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsValidChar(char c) => ValidFirstChar <= c && c <= ValidLastChar;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static bool IsNumericChar(char c) => ('0' <= c && c <= '9') || c == '-';

        private void ThrowEndOfStreamException() => throw new EndOfStreamException();

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _reader.Dispose();
                    _writer.Flush();
                    _writer.Dispose();
                }

                _disposedValue = true;
            }
        }

        public void Dispose()
        {
            Dispose(disposing: true);
            GC.SuppressFinalize(this);
        }
    }

    public static class UtilExtensions
    {
        public static bool ChangeMax<T>(ref this T value, T other) where T : struct, IComparable<T>
        {
            if (value.CompareTo(other) < 0)
            {
                value = other;
                return true;
            }
            return false;
        }

        public static bool ChangeMin<T>(ref this T value, T other) where T : struct, IComparable<T>
        {
            if (value.CompareTo(other) > 0)
            {
                value = other;
                return true;
            }
            return false;
        }

        public static void SwapIfLargerThan<T>(ref this T a, ref T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) > 0)
            {
                (a, b) = (b, a);
            }
        }

        public static void SwapIfSmallerThan<T>(ref this T a, ref T b) where T : struct, IComparable<T>
        {
            if (a.CompareTo(b) < 0)
            {
                (a, b) = (b, a);
            }
        }

        public static void Sort<T>(this T[] array) where T : IComparable<T> => Array.Sort(array);
        public static void Sort<T>(this T[] array, Comparison<T> comparison) => Array.Sort(array, comparison);
    }

    public static class CollectionExtensions
    {
        private class ArrayWrapper<T>
        {
            public T[] Array;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static Span<T> AsSpan<T>(this List<T> list)
        {
            return Unsafe.As<ArrayWrapper<T>>(list).Array.AsSpan(0, list.Count);
        }
    }
}

#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().run();
        }

        void run()
        {
            int t = ReadInt()[0];

            while (t != 0)
            {
                int n = ReadInt()[0];

                int[] arr = ReadInt();

                int id = -1;

                for(int i = 0; i < arr.Length; ++i)
                {
                    if(arr[i] == 1)
                    {
                        id = i;
                        break;
                    }
                }

                int l = id - 1, r = id + 1;

                bool[] res = new bool[n + 1];
                res[1] = true;

                int max = 1;

                int count = 1;

                while(true)
                {
                    if(l < 0 && r >= arr.Length)
                    {
                        break;
                    }
                    else if(l < 0)
                    {
                        max = Math.Max(max, arr[r]);
                        r++;
                    }
                    else if(r >= arr.Length)
                    {
                        max = Math.Max(max, arr[l]);
                        l--;
                    }
                    else
                    {
                        if (arr[l] < arr[r])
                        {
                            max = Math.Max(max, arr[l]);
                            l--;
                        }
                        else
                        {
                            max = Math.Max(max, arr[r]);
                            r++;
                        }
                    }

                    count++;
                    if(max == count)
                    {
                        res[count] = true;
                    }
                }

                string s = "";
                for(int i = 1; i <= n; ++i)
                {
                    if(res[i])
                    {
                        s += '1';
                    }
                    else
                    {
                        s += '0';
                    }
                }

                Console.WriteLine(s);

                t--;
            }

            return;
        }

        int[] ReadInt()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        long[] ReadLong()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        double[] ReadDouble()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CF
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().run();
        }

        void run()
        {
            int t = ReadInt()[0];

            while (t != 0)
            {
                int n = ReadInt()[0];

                int[] arr = ReadInt();

                int id = -1;

                for(int i = 0; i < arr.Length; ++i)
                {
                    if(arr[i] == 1)
                    {
                        id = i;
                        break;
                    }
                }

                int l = id - 1, r = id + 1;

                StringBuilder sb = new StringBuilder();
                sb.Append('1');
                int max = 1;

                int count = 1;

                while(true)
                {
                    if(l < 0 && r >= arr.Length)
                    {
                        break;
                    }
                    else if(l < 0)
                    {
                        max = Math.Max(max, arr[r]);
                        r++;
                    }
                    else if(r >= arr.Length)
                    {
                        max = Math.Max(max, arr[l]);
                        l--;
                    }
                    else
                    {
                        if (arr[l] < arr[r])
                        {
                            max = Math.Max(max, arr[l]);
                            l--;
                        }
                        else
                        {
                            max = Math.Max(max, arr[r]);
                            r++;
                        }
                    }

                    count++;
                    if(max == count)
                    {
                        sb.Append('1');
                    }
                    else
                    {
                        sb.Append('0');
                    }
                }

                Console.WriteLine(sb.ToString());

                t--;
            }

            return;
        }

        int[] ReadInt()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        long[] ReadLong()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        double[] ReadDouble()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        var sb = new StringBuilder();
        int t = sc.NextInt();
        for (int i = 0; i < t; i++)
        {
            sb.AppendLine(Query(sc.NextInt(), sc.IntArray()));
        }

        Console.Write(sb.ToString());
    }

    private string Query(int m, int[] p)
    {
        for (int i = 0; i < m; i++)
        {
            p[i]--;
        }

        char[] ans = new char[m];

        // 前true
        // 前のやつの範囲の隣にiがある?true:false

        // 前false
        //

        // st[i]iがあるindex;
        var st = new SegTree<int>(m, int.MaxValue);
        var st3 = new SegTree<int>(m, (a, b) => -a.CompareTo(b), int.MinValue);

        // st2 範囲の最大値
        var st2 = new SegTree<int>(m, (a, b) => -a.CompareTo(b), int.MinValue);

        for (int i = 0; i < m; i++)
        {
            st[p[i]] = i;
            st3[p[i]] = i;
            st2[i] = p[i];
        }

        ans[0] = '1';
        int l = st[0];
        int r = l + 1;
        for (int i = 1; i < m;)
        {
            int index = st[i];
            if (index == l - 1)
            {
                ans[i] = '1';
                l--;
                i++;
            }
            else if (index == r)
            {
                ans[i] = '1';
                r++;
                i++;
            }
            else
            {
                if (r < index)
                {
                    int mm = st2.Query(r, index);
                    int mmm = st.Query(0, mm);
                    for (; i < mm; i++)
                    {
                        ans[i] = '0';
                    }

                    l = mmm;
                    r = index + 1;
                    ans[mm] = '1';
                    i++;
                }
                else
                {
                    int mm = st2.Query(index, l);
                    int mmm = st3.Query(0, mm);
                    for (; i < mm; i++)
                    {
                        ans[i] = '0';
                    }

                    l = index;
                    r = mmm + 1;
                    ans[mm] = '1';
                    i++;
                }
            }
        }

        return new string(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class SegTree<T>
{
    private readonly T[] Array;
    private readonly Comparison<T> Compare;
    private readonly int N;
    private readonly T Max;

    public SegTree(int size, T max) : this(size, Comparer<T>.Default, max)
    {
    }

    public SegTree(int size, IComparer<T> comparer, T max) : this(size, comparer.Compare, max)
    {
    }

    public SegTree(int size, Comparison<T> comparison, T max)
    {
        Max = max;
        N = 1;
        while (N < size)
        {
            N *= 2;
        }

        Compare = comparison;
        Array = new T[2 * N];
        for (int i = 1; i < 2 * N; i++)
        {
            Array[i] = max;
        }
    }

    new public T this[int i]
    {
        get { return Array[i + N]; }
        set { Update(value, i); }
    }

    private T Min(T x, T y)
    {
        return Compare(x, y) < 0 ? x : y;
    }

    public void Update(T item, int index)
    {
        index += N;
        Array[index] = item;
        while (index > 1)
        {
            index /= 2;
            Array[index] = Min(Array[index * 2], Array[index * 2 + 1]);
        }
    }

    private T Q(int left, int right, int k, int l, int r)
    {
        if (left <= l && r <= right)
        {
            return Array[k];
        }

        if (r <= left || right <= l)
        {
            return Max;
        }

        return Min(Q(left, right, k * 2, l, (l + r) / 2), Q(left, right, k * 2 + 1, (l + r) / 2, r));
    }

    public T Query(int left, int right)
    {
        return Q(left, right, 1, 0, N);
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}


using System;
using System.Collections.Generic;
using System.Text;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        var sb = new StringBuilder();
        int t = sc.NextInt();
        for (int i = 0; i < t; i++)
        {
            sb.AppendLine(Query(sc.NextInt(), sc.IntArray()));
        }

        Console.Write(sb.ToString());
    }

    private string Query(int m, int[] p)
    {
        for (int i = 0; i < m; i++)
        {
            p[i]--;
        }

        var ans = new char[m];
        var rmq = new SegTree<int>(m, int.MaxValue);
        var min = new SegTree<int>(m, int.MaxValue);
        var max = new SegTree<int>(m, (a, b) => -a.CompareTo(b), int.MinValue);
        for (int i = 0; i < m; i++)
        {
            min[p[i]] = i;
            max[p[i]] = i;
            rmq[i] = p[i];
        }

        for (int i = 0; i < m; i++)
        {
            int mn = min.Query(0, i + 1);
            int mx = max.Query(0, i + 1);
            bool a = mx - mn + 1 == i + 1;
            bool b = rmq.Query(0, mn) > i;
            bool c = rmq.Query(mx + 1, m) > i;
            ans[i] = a && b && c ? '1' : '0';
        }

        return new string(ans);
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class SegTree<T>
{
    private readonly T[] Array;
    private readonly Comparison<T> Compare;
    private readonly int N;
    private readonly T Max;

    public SegTree(int size, T max) : this(size, Comparer<T>.Default, max)
    {
    }

    public SegTree(int size, IComparer<T> comparer, T max) : this(size, comparer.Compare, max)
    {
    }

    public SegTree(int size, Comparison<T> comparison, T max)
    {
        Max = max;
        N = 1;
        while (N < size)
        {
            N *= 2;
        }

        Compare = comparison;
        Array = new T[2 * N];
        for (int i = 1; i < 2 * N; i++)
        {
            Array[i] = max;
        }
    }

    new public T this[int i]
    {
        get { return Array[i + N]; }
        set { Update(value, i); }
    }

    private T Min(T x, T y)
    {
        return Compare(x, y) < 0 ? x : y;
    }

    public void Update(T item, int index)
    {
        index += N;
        Array[index] = item;
        while (index > 1)
        {
            index /= 2;
            Array[index] = Min(Array[index * 2], Array[index * 2 + 1]);
        }
    }

    private T Q(int left, int right, int k, int l, int r)
    {
        if (left <= l && r <= right)
        {
            return Array[k];
        }

        if (r <= left || right <= l)
        {
            return Max;
        }

        return Min(Q(left, right, k * 2, l, (l + r) / 2), Q(left, right, k * 2 + 1, (l + r) / 2, r));
    }

    public T Query(int left, int right)
    {
        return Q(left, right, 1, 0, N);
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}


using System;
using System.Collections.Generic;
using System.Text;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < t; i++)
            {
                Dictionary<int, int> indexes = new Dictionary<int, int>();

                int n = Convert.ToInt32(Console.ReadLine());
                string[] phrase = Console.ReadLine().Split(' ');

                for (int j = 0; j < n; j++)
                    indexes[Convert.ToInt32(phrase[j])] = j;

                int l = int.MaxValue, r = int.MinValue;
                StringBuilder result = new StringBuilder();

                for (int j = 1; j <= n; j++)
                {
                    if (indexes[j] > r)
                        r = indexes[j];

                    if (indexes[j] < l)
                        l = indexes[j];

                    if (r - l + 1 == j)
                        result.Append("1");
                    else
                        result.Append("0");
                }

				Console.WriteLine(result);
            }
        }
    }
}


using System;
using System.Collections.Generic;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());
            string[] results = new string[t];

            for (int i = 0; i < t; i++)
            {
                Dictionary<int, int> indexes = new Dictionary<int, int>();

                int n = Convert.ToInt32(Console.ReadLine());
                string[] phrase = Console.ReadLine().Split(' ');

                for (int j = 0; j < n; j++)
                    indexes[Convert.ToInt32(phrase[j])] = j;

                int l = int.MaxValue, r = int.MinValue;

                for (int j = 1; j <= n; j++)
                {
                    if (indexes[j] > r)
                        r = indexes[j];

                    if (indexes[j] < l)
                        l = indexes[j];

                    if (r - l + 1 == j)
                        results[i] += "1";
                    else
                        results[i] += "0";
                }
            }

            foreach (string result in results)
                Console.WriteLine(result);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < t; i++)
            {
                Dictionary<int, int> indexes = new Dictionary<int, int>();

                int n = Convert.ToInt32(Console.ReadLine());
                string[] phrase = Console.ReadLine().Split(' ');

                for (int j = 0; j < n; j++)
                    indexes[Convert.ToInt32(phrase[j])] = j;

                int l = int.MaxValue, r = int.MinValue;
                StringBuilder result = new StringBuilder();

                for (int j = 1; j <= n; j++)
                {
                    if (indexes[j] > r)
                        r = indexes[j];

                    if (indexes[j] < l)
                        l = indexes[j];

                    if (r - l + 1 == j)
                        result.Append("1");
                    else
                        result.Append("0");

                    Console.WriteLine(result);
                }
            }
        }
    }
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var t = input.ReadInt();
      var ans = new StringBuilder();
      for (int i = 0; i < t; i++)
      {
        var n = input.ReadInt();
        var p = input.ReadIntArray(n);
        var beauty = new int[n];
        beauty[0] = 1;
        var pos = new int[n + 1];
        for (int j = 0; j < n; j++)
          pos[p[j]] = j;
        var l = pos[1];
        var r = l;
        for (int j = 2; j <= n; j++)
        {
          l = Min(l, pos[j]);
          r = Max(r, pos[j]);
          if (r - l + 1 == j)
            beauty[j - 1] = 1;
        }
        ans.AppendLine(string.Join("", beauty));
      }
      Write(ans);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    internal class SegmentTree<T>
      {
        private readonly Func<T, T, T> func;
        private readonly T[] t;
        private readonly int n;

        public T Query(int l, int r)
        {
          return Query(1, 0, n - 1, l, r);
        }

        private T Query(int v, int tl, int tr, int l, int r)
        {
          if (l > r)
            return default(T);
          if (l == tl && r == tr)
            return t[v];
          int tm = tl + (tr - tl) / 2;
          return func(Query(v * 2, tl, tm, l, Min(r, tm)),
            Query(v * 2 + 1, tm + 1, tr, Max(l, tm + 1), r));
        }

        public void Update(int pos, T value)
        {
          Update(1, 0, n - 1, pos, value);
        }

        private void Update(int v, int tl, int tr, int pos, T value)
        {
          if (tl == tr)
          {
            t[v] = value;
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            if (pos <= tm)
              Update(v * 2, tl, tm, pos, value);
            else
              Update(v * 2 + 1, tm + 1, tr, pos, value);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        private void Build(T[] data, int v, int tl, int tr)
        {
          if (tl == tr)
          {
            t[v] = data[tl];
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            Build(data, v * 2, tl, tm);
            Build(data, v * 2 + 1, tm + 1, tr);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        public SegmentTree(T[] data, Func<T, T, T> f)
        {
          func = f;
          n = data.Length;
          t = new T[4 * n];
          Build(data, 1, 0, n - 1);
        }
      }

    public void Solve()
    {
      var t = input.ReadInt();
      for (int i = 0; i < t; i++)
      {
        var n = input.ReadInt();
        var p = input.ReadIntArray(n);
        var beauty = new int[n + 1];
        Fill(beauty, 1);
        var st = new SegmentTree<int>(p, Max);
        var pos = new int[n + 1];
        for (int j = 0; j < n; j++)
          pos[p[j]] = j;
        var l = pos[1];
        var r = l;
        for (int j = 2; j <= n; j++)
        {
          l = Min(l, pos[j]);
          r = Max(r, pos[j]);
          if (r - l + 1 != j || st.Query(l, r) > j)
            beauty[j] = 0;
        }
        WriteLine(string.Join("", beauty.Skip(1)));
      }
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    internal class SegmentTree<T>
      {
        private readonly Func<T, T, T> func;
        private readonly T[] t;
        private readonly int n;

        public T Query(int l, int r)
        {
          return Query(1, 0, n - 1, l, r);
        }

        private T Query(int v, int tl, int tr, int l, int r)
        {
          if (l > r)
            return default(T);
          if (l == tl && r == tr)
            return t[v];
          int tm = tl + (tr - tl) / 2;
          return func(Query(v * 2, tl, tm, l, Min(r, tm)),
            Query(v * 2 + 1, tm + 1, tr, Max(l, tm + 1), r));
        }

        public void Update(int pos, T value)
        {
          Update(1, 0, n - 1, pos, value);
        }

        private void Update(int v, int tl, int tr, int pos, T value)
        {
          if (tl == tr)
          {
            t[v] = value;
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            if (pos <= tm)
              Update(v * 2, tl, tm, pos, value);
            else
              Update(v * 2 + 1, tm + 1, tr, pos, value);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        private void Build(T[] data, int v, int tl, int tr)
        {
          if (tl == tr)
          {
            t[v] = data[tl];
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            Build(data, v * 2, tl, tm);
            Build(data, v * 2 + 1, tm + 1, tr);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        public SegmentTree(T[] data, Func<T, T, T> f)
        {
          func = f;
          n = data.Length;
          t = new T[4 * n];
          Build(data, 1, 0, n - 1);
        }
      }

    public void Solve()
    {
      var t = input.ReadInt();
      for (int i = 0; i < t; i++)
      {
        var n = input.ReadInt();
        var p = input.ReadIntArray(n);
        var beauty = new int[n + 1];
        for (int j = 0; j < n + 1; j++)
          beauty[j] = 1;
        var st = new SegmentTree<int>(p, Max);
        var pos = new int[n + 1];
        for (int j = 0; j < n; j++)
          pos[p[j]] = j;
        var l = pos[1];
        var r = l;
        for (int j = 2; j <= n; j++)
        {
          l = Min(l, pos[j]);
          r = Max(r, pos[j]);
          if (r - l + 1 != j || st.Query(l, r) > j)
            beauty[j] = 0;
        }
        WriteLine(string.Join("", beauty.Skip(1)));
      }
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    internal class SegmentTree<T>
      {
        private readonly Func<T, T, T> func;
        private readonly T[] t;
        private readonly int n;

        public T Query(int l, int r)
        {
          return Query(1, 0, n - 1, l, r);
        }

        private T Query(int v, int tl, int tr, int l, int r)
        {
          if (l > r)
            return default(T);
          if (l == tl && r == tr)
            return t[v];
          int tm = tl + (tr - tl) / 2;
          return func(Query(v * 2, tl, tm, l, Min(r, tm)),
            Query(v * 2 + 1, tm + 1, tr, Max(l, tm + 1), r));
        }

        public void Update(int pos, T value)
        {
          Update(1, 0, n - 1, pos, value);
        }

        private void Update(int v, int tl, int tr, int pos, T value)
        {
          if (tl == tr)
          {
            t[v] = value;
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            if (pos <= tm)
              Update(v * 2, tl, tm, pos, value);
            else
              Update(v * 2 + 1, tm + 1, tr, pos, value);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        private void Build(T[] data, int v, int tl, int tr)
        {
          if (tl == tr)
          {
            t[v] = data[tl];
          }
          else
          {
            int tm = tl + (tr - tl) / 2;
            Build(data, v * 2, tl, tm);
            Build(data, v * 2 + 1, tm + 1, tr);
            t[v] = func(t[v * 2], t[v * 2 + 1]);
          }
        }

        public SegmentTree(T[] data, Func<T, T, T> f)
        {
          func = f;
          n = data.Length;
          t = new T[4 * n];
          Build(data, 1, 0, n - 1);
        }
      }

    public void Solve()
    {
      var t = input.ReadInt();
      for (int i = 0; i < t; i++)
      {
        var n = input.ReadInt();
        var p = input.ReadIntArray(n);
        var beauty = new int[n + 1];
        for (int j = 0; j < n + 1; j++)
          beauty[j] = 1;
        var st = new SegmentTree<int>(p, Max);
        var pos = new int[n + 1];
        for (int j = 0; j < n; j++)
          pos[p[j]] = j;
        var l = pos[1];
        var r = l;
        for (int j = 2; j <= n; j++)
        {
          l = Min(l, pos[j]);
          r = Max(r, pos[j]);
          if (r - l + 1 != j)// || st.Query(l, r) > j)
            beauty[j] = 0;
        }
        WriteLine(string.Join("", beauty.Skip(1)));
      }
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}


using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int T = int.Parse(Console.ReadLine());
		for(var t=0;t<T;t++){
			int N = int.Parse(Console.ReadLine());
			int[]D = new int[N];
			string[] str = Console.ReadLine().Split();
			for(var i=0;i<N;i++){
				int a = int.Parse(str[i]);
				D[a-1] = i;
			}
			int min = D[0];
			int max = D[0];
			Console.Write("1");
			for(var i=1;i<N;i++){
				min = Math.Min(min,D[i]);
				max = Math.Max(max,D[i]);
				if(max-min==i){
					Console.Write("1");
				} else {
					Console.Write("0");
				}
			}
			Console.WriteLine();
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;

public   class Program
    {

    /* Input Methoden :
     *
     * Integer: int n = int.Parse(Console.ReadLine());
     * String:  String n = Console.ReadLine();
     * Integer Array: int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();
     * String Array:  String[] input = Console.ReadLine().Split(' ');
     *
     * --- Datenstrukturen:
     *   List<Int16> list = new List<Int16>();
     *   HashSet<int> hset = new HashSet<int>();
     *         Dictionary<int, int> dict = new Dictionary<int, int>();
     *
     *
     * Ausgabe: Console.WriteLine();
     *
     *
     *
     */
    static void Main(string[] args)
        {
        int tc = int.Parse(Console.ReadLine());
        while (tc-- > 0) {
            int n = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();

            int[] sortedValues = new int[n+1];
            for (int i = 0; i < n; i++) {
                sortedValues[input[i]] = i;

            }
            int[] sol = new int[n];
            int[] chains = new int[n + 1];

            for (int i = 1; i < sortedValues.Length; i++) {

                int indexNumber = sortedValues[i];

                // überprüfen ob wert = i;
                int left = indexNumber - 1 < 0 ? sortedValues.Length - 1 : indexNumber - 1;
                int right = indexNumber + 1;

                chains[indexNumber] = 1 + chains[left] + chains[right];

                if (chains[indexNumber] == i)
                {
                    sol[i-1] = 1;
                }
                else {
                    sol[i-1] = 0;
                }

                // links und rechts bereich aktualisieren

                if (chains[left] != 0) {
                    int range = chains[left]-1;
                    int val = chains[indexNumber];

                    chains[left] = val;
                    chains[left - range] = val;

                }
                if (chains[right] != 0)
                {
                    int range = chains[right]-1;
                    int val = chains[indexNumber];

                    chains[right] = val;
                    chains[right+range] = val;

                }

            }

            foreach (int p in sol) {
                Console.Write(p);
                   }
            Console.WriteLine();

        }
        Console.ReadLine();
    }
    }


using System;
using System.Collections.Generic;
using System.Linq;

public   class Program
    {

    /* Input Methoden :
     *
     * Integer: int n = int.Parse(Console.ReadLine());
     * String:  String n = Console.ReadLine();
     * Integer Array: int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();
     * String Array:  String[] input = Console.ReadLine().Split(' ');
     *
     * --- Datenstrukturen:
     *   List<Int16> list = new List<Int16>();
     *   HashSet<int> hset = new HashSet<int>();
     *         Dictionary<int, int> dict = new Dictionary<int, int>();
     *
     *
     * Ausgabe: Console.WriteLine();
     *
     *
     *
     */
    static void Main(string[] args)
        {
        int tc = int.Parse(Console.ReadLine());
        while (tc-- > 0) {
            int n = int.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split(' ').Select(r => Convert.ToInt32(r)).ToArray();

            int[] sortedValues = new int[n+1];
            for (int i = 0; i < n; i++) {
                sortedValues[input[i]] = i;

            }
            int[] sol = new int[n];
            int[] chains = new int[n + 1];

            for (int i = 1; i < sortedValues.Length; i++) {

                int indexNumber = sortedValues[i];

                // überprüfen ob wert = i;
                int left = indexNumber - 1 < 0 ? sortedValues.Length - 1 : indexNumber - 1;
                int right = indexNumber + 1;

                chains[indexNumber] = 1 + chains[left] + chains[right];

                if (chains[indexNumber] == i)
                {
                    sol[i-1] = 1;
                }
                else {
                    sol[i-1] = 0;
                }

                // links und rechts bereich aktualisieren

                if (chains[left] != 0) {
                    int range = chains[left]-1;
                    int val = chains[indexNumber];

                    chains[left] = val;
                    chains[left - range] = val;

                }
                if (chains[right] != 0)
                {
                    int range = chains[right]-1;
                    int val = chains[indexNumber];

                    chains[right] = val;
                    chains[right+range] = val;

                }

            }

            foreach (int p in sol) {
                Console.WriteLine(p);
                   }

        }
        Console.ReadLine();
    }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using SB = System.Text.StringBuilder;

class Program
{
    static void Main()
    {
        int T = int.Parse(Console.ReadLine());

        for (int t = 0; t < T; t++)
        {
            int n = int.Parse(Console.ReadLine());
            int[] s = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int[] sinv = new int[n];

            for (int i = 0; i < n; i++)
            {
                sinv[s[i] - 1] = i + 1;
            }

            int max = sinv[0];
            int min = sinv[0];

            char[] ans = new char[n];

            for (int i = 0; i < n; i++)
            {
                max = Math.Max(max, sinv[i]);
                min = Math.Min(min, sinv[i]);

                ans[i] = (max - min) == i ? '1' : '0';
            }

            Console.WriteLine(new string(ans));
        }

#if DEBUG
        Console.ReadKey();
#endif
    }

}


using System;
using System.Linq;
using System.Text;

public struct B : IComparable
{
    public int N { get; set; }
    public int P { get; set; }

    public int CompareTo(object obj)
    {
        return N.CompareTo(((B)obj).N);
    }
}
public class A
{
    public static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());
        while(t > 0)
        {
            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
            var bb = new B[n];
            for(int i = 0; i < n; i++)
            {
                bb[i].N = arr[i];
                bb[i].P = i;
            }
            Array.Sort(bb);
            var min = new int[n];
            var max = new int[n];
            min[0] = bb[0].P;
            max[0] = bb[0].P;
            for (int i = 1; i < n; i++)
            {
                min[i] = Math.Min(bb[i].P, min[i-1]);
                max[i] = Math.Max(bb[i].P, max[i - 1]);
            }
            var sb = new StringBuilder();
            for(int i = 0; i < n; i++)
            {
                if(max[i] - min[i] == i)
                {
                    sb.Append("1");
                } else
                {
                    sb.Append("0");
                }
            }
            Console.WriteLine(sb.ToString());
            t--;
        }
    }
}


//#define EXTENDSTACKSIZE

using System;
 using System.Collections.Generic;
 using System.Globalization;
using System.IO;
using System.Linq;
 using System.Text;
 using System.Threading;

         namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var tests = sr.NextInt32();
            var answers = new StringBuilder();
            for (var t = 0; t < tests; t++) {
                var n = sr.NextInt32();
                var numbers = new Tuple<int, int>[n];
                for (var i = 0; i < n; i++) {
                    numbers[i] = Tuple.Create(sr.NextInt32(), i);
                }

                Array.Sort(numbers, (a, b) => a.Item1.CompareTo(b.Item1));
                var min = 0;
                var max = n - 1;
                var currAnsw = new char[n];
                for (var i = n - 1; i > 0; i--) {
                    var curr = numbers[i].Item2;
                    if ((max - min) >= i) {
                        currAnsw[i] = '1';
                    }
                    else {
                        currAnsw[i] = '0';
                    }

                    if (numbers[0].Item2 < curr) {
                        max = Math.Min(curr - 1, max);
                    }
                    else {
                        min = Math.Max(min, curr + 1);
                        //max = Math.Max(max, numbers[0].Item2);
                    }

//                    if (Math.Abs(max - curr) <= Math.Abs(curr - min)) {
//                        max = Math.Min(curr - 1, max);
//                    }
//                    else {
//                        min = Math.Max(curr + 1, min);
//                    }
                }

                currAnsw[0] = '1';
                currAnsw[n - 1] = '1';

                answers.AppendLine(new string(currAnsw));
            }

            sw.Write(answers);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


//#define EXTENDSTACKSIZE

using System;
 using System.Collections.Generic;
 using System.Globalization;
using System.IO;
using System.Linq;
 using System.Text;
 using System.Threading;

         namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var tests = sr.NextInt32();
            var answers = new StringBuilder();
            for (var t = 0; t < tests; t++) {
                var n = sr.NextInt32();
                var numbers = new Tuple<int, int>[n];
                for (var i = 0; i < n; i++) {
                    numbers[i] = Tuple.Create(sr.NextInt32(), i);
                }

                Array.Sort(numbers, (a, b) => a.Item1.CompareTo(b.Item1));
                var min = 0;
                var max = n;
                var currAnsw = new char[n];
                for (var i = n - 1; i > 0; i--) {
                    var curr = numbers[i].Item2;
                    if ((max - min) >= i) {
                        currAnsw[i] = '1';
                    }
                    else {
                        currAnsw[i] = '0';
                    }

                    if (numbers[0].Item2 < curr) {
                        max = Math.Min(curr - 1, max);
                    }
                    else {
                        min = Math.Max(min, curr + 1);
                        //max = numbers[0].Item2;
                    }

//                    if (Math.Abs(max - curr) <= Math.Abs(curr - min)) {
//                        max = Math.Min(curr - 1, max);
//                    }
//                    else {
//                        min = Math.Max(curr + 1, min);
//                    }
                }

                currAnsw[0] = '1';

                answers.AppendLine(new string(currAnsw));
            }

            sw.Write(answers);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        struct element:IComparable
        {
            public int value;
            public int index;

            public int CompareTo(object obj)
            {
                element second = (element)obj;
                return value.CompareTo(second.value);
            }
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            while(t--!=0)
            {
                int n = int.Parse(Console.ReadLine());
                List<element> elements = new List<element>();
                string[] str = Console.ReadLine().Split();
                for(int i = 0; i<n; i++)
                {
                    elements.Add(new element() { value = int.Parse(str[i]), index = i });
                }
                elements.Sort();
                StringBuilder result = new StringBuilder();
                int indexMin = int.MaxValue;
                int indexMax = int.MinValue;
                for(int i = 0; i<n; i++)
                {
                    if (elements[i].index < indexMin)
                        indexMin = elements[i].index;
                    if (elements[i].index > indexMax)
                        indexMax = elements[i].index;
                    if (indexMax - indexMin == i)
                        result.Append("1");
                    else
                        result.Append("0");

                }
                Console.WriteLine(result);
            }
        }
    }
}


/* Date: 24.01.2020  *  Time: 21:45 */
//
// CF 604 B
//
// https://docs.microsoft.com/en-us/dotnet/api/system.tuple-8?redirectedfrom=MSDN&view=netframework-4.7.2
//
//

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
# if ( ! ONLINE_JUDGE )
	public static StreamReader sr = new StreamReader ("C:\\TRR\\2020\\Task\\07 Codeforces\\044\\B.TXT");
	public static StreamWriter sw = new StreamWriter ("C:\\TRR\\2020\\Task\\07 Codeforces\\044\\OUTPUT.OUT");
# endif

	public static void Swap (ref int a, ref int b)
	{
		int c = a; a = b; b = c;
	}
	public static int GCD (int a, int b)
	{
		while ( a != 0 && b != 0 )
			if ( a > b )
				a %= b;
			else
				b %= a;
		return ( a > 0 ? a : b );
	}
	class Pair : IComparable
	{
		public int fi, se;
		public Pair ()
		{
			fi = 0; se = 0;
		}
		public Pair (int pfi, int pse)
		{
			fi = pfi; se = pse;
		}
		public Pair (Pair p)
		{
			fi = p.fi; se = p.se;
		}
		public static bool operator < (Pair p1, Pair p2)
		{
			return p1.fi < p2.fi || p1.fi == p2.fi && p1.se < p2.se;
		}
		public static bool operator > (Pair p1, Pair p2)
		{
			return p1.fi > p2.fi || p1.fi == p2.fi && p1.se > p2.se;
		}
		public int CompareTo (object p2)
		{
			if ( this < (p2 as Pair) )
				return -1;
			if ( this > (p2 as Pair) )
				return 1;
			return 0;
		}
	}

	public const int K = 30000;
	public static int [] p = new int [K];
	public static void Primes ()   // calculate primes
{
   int i, j, k, ki;
   bool ok;

   p [0] = 2; p [1] = 3; p [2] = 5; p [3] = 7; p [4] = 11; p [5] = 13;
   p [6] = 17; p [7] = 19; p [8] = 23; p [9] = 29; p [10] = 31;
   p [11] = 37; p [12] = 41; p [13] = 43; p [14] = 47; p [15] = 53;
   p [16] = 59; p [17] = 61; p [18] = 67; p [19] = 71; p [20] = 73;
   p [21] = 79; p [22] = 83; p [23] = 89; p [24] = 97; p [25] = 101;

   for ( i=26; i < K; i++ )
   {
      for ( k=p [i-1]+2; ; k+=2 )
      {
         ki = (int) Math.Sqrt (k) + 2;
         for ( ok=true, j=0; p [j] < ki; j++ )           // ??? p [j] < ki ???
         	if ( k % p [j] == 0 )
               { ok = false; break;}
         if ( ok ) break;
      }
      p [i] = k;
   }
}

	public static void Main (string[] args)
	{
		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int q;

# if ( ONLINE_JUDGE )
		q = int.Parse (Console.ReadLine ());
# else
		q = int.Parse (sr.ReadLine ());
		sw.WriteLine ("*** TEST = " + q);
# endif

		for ( int _q=0; _q < q; _q++ )
		{
			int n;
			string s;

# if ( ONLINE_JUDGE )
			n = int.Parse (Console.ReadLine ());
			s = Console.ReadLine ();
# else
			n = int.Parse (sr.ReadLine ());
			sw.WriteLine ("*** n = " + n);
			s = (sr.ReadLine ());
			sw.WriteLine ("*** " + s);
# endif

			int [] a = new int [n+1];
			{
				string [] ss = s.Split (' ');
				for ( int i=0; i < n; i++ )
				{
					int b = int.Parse (ss [i]);
					a [b] = i;
				}
			}
			int L = a [1], R = a [1];

# if ( ONLINE_JUDGE )
			Console.Write ("1");
# else
			sw.Write ("1");
# endif

			for ( int i=2; i <= n; i++ )
			{
				if ( a [i] < L )
					L = a [i];
				if ( a [i] > R )
					R = a [i];

				bool ok = R - L + 1 == i;

# if ( ONLINE_JUDGE )
				if ( ok )
					Console.Write ("1");
				else
					Console.Write ("0");
# else
				if ( ok )
					sw.Write ("1");
				else
					sw.Write ("0");
# endif
			}

# if ( ONLINE_JUDGE )
			Console.WriteLine ();
# else
			sw.WriteLine ();
# endif

		}

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif
	}
}


using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static void Solve()
    {
        var t = int.Parse(Console.ReadLine());
        for (int _i = 0; _i < t; _i++)
        {
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split().Select(int.Parse).ToList();
            var beautiful = new bool[n];
            var index = new int[n + 1];
            for (int i = 0; i < n; i++)
            {
                index[p[i]] = i;
            }
            beautiful[0] = true;
            var cur = 1;
            var min = index[1];
            var max = index[1];
            while (cur < n)
            {
                cur++;
                var ind = index[cur];
                if (ind < min)
                {
                    min = ind;
                }
                else if (max < ind)
                {
                    max = ind;
                }
                var num = max - min + 1;
                beautiful[cur - 1] = cur == num;
            }
            var S = beautiful.Select(x => x ? '1' : '0').ToArray();
            Console.WriteLine(new string(S));
        }
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

class MyClass
{
    public static void Solve()
    {
        var t = int.Parse(Console.ReadLine());
        for (int _i = 0; _i < t; _i++)
        {
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split().Select(int.Parse).ToList();
            var beautiful = new bool[n];
            beautiful[0] = true;
            var cur = 1;
            var min = p.IndexOf(1);
            var max = p.IndexOf(1);
            while (cur < n)
            {
                cur++;
                var ind = p.IndexOf(cur);
                if (ind < min)
                {
                    for (int i = ind; i < min; i++)
                    {
                        cur = Math.Max(cur, p[i]);
                    }
                    min = ind;
                }
                else
                {
                    for (int i = max + 1; i <= ind; i++)
                    {
                        cur = Math.Max(cur, p[i]);
                    }
                    max = ind;
                }
                beautiful[cur - 1] = true;
            }
            var S = beautiful.Select(x => x ? '1' : '0').ToArray();
            Console.WriteLine(new string(S));
        }
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Console = System.Console;

namespace ConsoleApp3
{
    public class problemB604
    {
        static void Main(string[] args)
        {
            int T = int.Parse(Console.ReadLine());
            var res = new List<string>();
            for (int i = 0; i < T; i++)
            {
                int N = int.Parse(Console.ReadLine());
                int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
                res.Add(treatment(arr));

            }

            foreach (var r in res)
                Console.WriteLine(r);

        }

        static string treatment(int[] arr)
        {
            int n = arr.Length;
            int[] indexes = new int[n];
            var res = new int[n];
            for (int i = 0; i < n; i++)
            {
                indexes[arr[i] - 1] = i;
            }

            int min = indexes[0];
            int max = indexes[0];
            for (int i = 0; i < n; i++)
            {
                min = Math.Min(indexes[i], min);
                max = Math.Max(indexes[i], max);
                if ((max - min) == i)
                    res[i] = 1;
            }

            return string.Join("", res);
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Console = System.Console;

namespace ConsoleApp3
{
    public class problemB604
    {
        static void Main(string[] args)
        {
            int T = int.Parse(Console.ReadLine());
            var res = new List<string>();
            for (int i = 0; i < T; i++)
            {
                int N = int.Parse(Console.ReadLine());
                int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
                res.Add(treatment(arr));

            }

            foreach (var r in res)
                Console.WriteLine(res);

        }

        static string treatment(int[] arr)
        {
            int n = arr.Length;
            int[] indexes = new int[n];
            var res = new int[n];
            for (int i = 0; i < n; i++)
            {
                indexes[arr[i] - 1] = i;
            }

            int min = indexes[0];
            int max = indexes[0];
            for (int i = 0; i < n; i++)
            {
                min = Math.Min(indexes[i], min);
                max = Math.Max(indexes[i], max);
                if ((max - min) == i)
                    res[i] = 1;
            }

            return string.Join("", res);
        }

    }
}


using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.Text;

class Program
{
    private static void Main()
    {
        //InputFromFile();

        int t = ConsoleReadLineAsInteger();

        while(t > 0)
        {
            int n = ConsoleReadLineAsInteger();
            int[] pp = ConsoleReadLineAsArrayOfIntegers();
            Dictionary<int, int> lookup = new Dictionary<int, int>();

            for(int i = 0; i < pp.Length; ++i)
                lookup[pp[i]] = i;

            int left = -1;
            int right = n + 100;
            for(int i = 1; i <= n; ++i)
            {
                bool isok = false;
                if (i == 1) { isok = true; left = lookup[i]; right = left;}
                else if (i == n) isok = true;
                else
                {
                    int newIndex = lookup[i];
                    if (newIndex < left) left = newIndex;
                    if (newIndex > right) right = newIndex;
                    int distance = right - left;
                    isok = distance + 1 == i;
                }
                Console.Write(isok ? "1" : "0");
                //Console.WriteLine(i + " " + lookup[i] + " " + left + " " + right);
             }
             Console.WriteLine();
             t--;
        }
    }

    #region HELPERS

    struct MyTuple { public long i; public long j; public MyTuple(int a, int b) { i = a; j = b; } }

    private static int GCD(int a, int b)
    {
        while (b != 0)
        {
            a %= b;
            Swap(ref a, ref b);
        }
        return a;
    }

    private static void Swap(ref int a, ref int b)
    {
        int c = a;
        a = b;
        b = c;
    }

    private static bool IsAllBitsSet(int n)
    {
        if (n == 0) return false;
        return (n & (n+1)) == 0;
    }

    private static bool IsPalindrom(string s)
    {
        char[] ss = s.ToCharArray();
        for(int i = 0; i < Math.Floor(ss.Length / 2f); ++i)
        {
            if (ss[i] != ss[ss.Length - 1 - i]) return false;
        }
        return true;
    }

    private static long FastPow(long a, long pw, long mod)
    {
        long res = 1;
        a %= mod;
        while (pw > 0)
        {
            if ((pw & 1) != 0)
                res = (res * a) % mod;
            a = (a * a) % mod;
            pw >>= 1;
        }
        return res;
    }

    #endregion

    #region INPUT OUTPUT
    private static void InputFromFile()
    {
        Console.SetIn(File.OpenText("input.txt"));
    }

    private static long[] ConsoleReadLineAsArrayOfLongsDescending()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt64(n)).ToArray();
    }

    private static long[] ConsoleReadLineAsArrayOfLongs()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt64(n)).ToArray();
    }

    private static int[] ConsoleReadLineAsArrayOfIntegers()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
    }

    private static int[] ConsoleReadLineAsArrayOfIntegersReversed()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).Reverse().ToArray();
    }

    private static long ConsoleReadLineAsLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }

    private static int ConsoleReadLineAsInteger()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    private static void ConsoleWriteLine(string line)
    {
        Console.WriteLine(line);
    }
    #endregion
}