#include #define debug(x) cerr<<"\tDEBUG: "<<#x<<" = "<<(x)<47); } int n; int fa[maxn]; int getfa(int x){ return fa[x]==x?x:fa[x]=getfa(fa[x]); } int main(){ int QuQ=1; // cin>>QuQ; while(QuQ--){ Rd(n); for(int i=1;i<=n+1;i++) fa[i]=i; for(int i=1,op,x;i<=n;i++){ Rd(op);Rd(x); if(op==1){ fa[x]=x+1; }else { int tmp=getfa(1); if(tmp==x){ tmp=getfa(tmp+1); } printf("%d\n",tmp); } } } return 0; } /* 1 4 4 2 1 2 1 2 4 0 1 3 0 3 4 0 */