#include<bits/stdc++.h>
using namespace std;
const int BS=1<<20;
char buf[BS],*P1,*P2;
inline char gc(){
if(P1==P2)P2=(P1=buf)+fread(buf,1,BS,stdin);
return P1==P2?EOF:*(P1++);
}
inline int in(){
int x=0,f=1;char ch=gc();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
while(ch>='0'&&ch<='9')x=x*10+ch-48,ch=gc();
return x*f;
}
const int N=1e6+5;
int n,px[N],py[N];
vector<int> v[N];
int up[N],down[N];
int pre[N],nxt[N];
int mark[N];
bool insert(int x,int y,int id){
if(mark[id]!=0)return 1;
if(!up[y]){
up[y]=id;
return mark[id]=1;
}else if(px[up[y]]>x){
mark[id]=1;
if(!down[y])down[y]=up[y],up[y]=id;
else{
int p=up[y],tmp=p;
mark[p]=-1;up[y]=id;
for(p=pre[p];p&&!insert(px[p],py[p],p);p=pre[p]);
p=tmp;
for(p=nxt[p];p&&!insert(px[p],py[p],p);p=nxt[p]);
}
return 1;
}if(!down[y]){
down[y]=id;
return mark[id]=1;
}else if(px[down[y]]>=x){
mark[id]=-1;
return 0;
}else{
int p=down[y],tmp=p;
mark[id]=1;
mark[p]=-1;down[y]=id;
for(p=pre[p];p&&!insert(px[p],py[p],p);p=pre[p]);
p=tmp;
for(p=nxt[p];p&&!insert(px[p],py[p],p);p=nxt[p]);
return 1;
}
}
int main(){
n=in();
int mx=0;
for(int i=1;i<=n;i++){
px[i]=in(),py[i]=in();
v[px[i]].push_back(i);
mx=max(mx,px[i]);
}
for(int i=1;i<=mx;i++){
if(!v[i].size())continue;
sort(v[i].begin(),v[i].end(),[](int a,int b){return py[a]<py[b];});
for(int j=0;j<v[i].size();j++){
if(j>0)pre[v[i][j]]=v[i][j-1];
if(j+1<v[i].size())nxt[v[i][j]]=v[i][j+1];
}
}
for(int i=1;i<=mx;i++){
for(int j:v[i])
if(insert(i,py[j],j))break;
reverse(v[i].begin(),v[i].end());
for(int j:v[i])
if(insert(i,py[j],j))break;
}
for(int i=1;i<=n;i++)putchar(mark[i]==1?'1':'0');
puts("");
return 0;
}