#include using namespace std; const int N=5000005; int a[N],p=1,q=2,n,x,y; int main(){ cin>>n; while(n--){ scanf("%d%d",&x,&y); if(x==1){ a[y]=1; if(y==p)p=q++; while(a[q])q++; } else cout<<(y==p?q:p)<<'\n'; } return 0; }