#include using namespace std; #define max_n 5000000 int a[max_n+1]; int main(){ int n,ans1=1,ans2=2; scanf("%d",&n); for(int i=n,op,x; i; --i){ scanf("%d%d",&op,&x); if(op==1){ a[x]=1; if(ans1==x){ ans1=ans2; while(a[++ans2]); } else if(ans2==x) while(a[++ans2]); } else{ if(ans1==x) printf("%d\n",ans2); else printf("%d\n",ans1); } } return 0; }