/*
TASK: seq
LANG: C++
*/
#include<iostream>
using namespace std;
int n,pos,i,a[100000],tek[99999],tek1[99999],br1=1,br=1,j,k,b[1000000],br2=0;
int main(){
cin >>n;
for(i=0;i<n;i++){
cin>>pos;
for(j=0;j<pos;j++)cin>> a[j];
tek[0]=-32767;
tek1[0]=-32767;
for(k=0;k<pos;k++)
if(tek[br-1]<a[k]){tek[br]=a[k]; br++;}
else if(tek1[br1-1]<a[k]){tek1[br1]=a[k]; br1++;}
else break;
if(k==pos){b[br2]=1;br2++;}
else{ b[br2]=0; br2++;}
if(br1==1 && k==pos){tek1[1]=tek[br-1]; br1++;br--;}
}
for(i=0;i<br2;i++) cout<<b[i];
cout<<endl;

/*for(i=1;i<br;i++) cout<<tek[i];
cout<<endl;
for(i=1;i<br1;i++) cout<<tek1[i];
cout<<endl;
system("pause");
*/
return 0;
}

