#include using namespace std; const int maxn=5e6+100; const int mode=1e9+7; int read(){ int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){ if(ch=='-') f=-1; ch=getchar(); } while(isdigit(ch)){ x=x*10+ch-'0'; ch=getchar(); } return x*f; } int t,n,temp[maxn],fa[maxn]; int find_fa(int x){ if(fa[x]==x) return x; return fa[x]=find_fa(fa[x]); } int main(){ n=read(); int sign,x,ans=0; for(int i=1;i<=n;++i){ sign=read(); x=read(); if(sign==1){ if(temp[x]==1) continue; fa[x]=x; temp[x]=1; if(x1&&temp[x-1]==1){ fa[x-1]=fa[x]; } if(x==ans+1){ fa[ans]=fa[x]; ans=fa[x]; } } else{ if(temp[x]==1||x>ans+1) printf("%d\n",ans+1); else{ if(temp[x+1]==0) printf("%d\n",x+1); else printf("%d\n",find_fa(x+1)+1); } } /*cout<<"%fa: "; for(int j=1;j<=5;++j) cout<