#include #define MN 5000000 int a[MN+5],itr[2]={1,2}; int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++){ int o,x; scanf("%d%d",&o,&x); if(o==1){ if(a[x]==0){ a[x] = 1; if(x==itr[0]){ itr[0] = itr[1]; itr[1]++; while(a[itr[1]]==1) itr[1]++; }else if(x==itr[1]){ while(a[itr[1]]==1) itr[1]++; } } }else{ if(x==itr[0]) printf("%d\n",itr[1]); else printf("%d\n",itr[0]); } } }