#include using namespace std; typedef long long ll; typedef pair PII; const int maxn=5555555,mod=998244353; #define fi first #define se second #define MP make_pair #define PB push_back #define lson o<<1,l,mid #define rson o<<1|1,mid+1,r #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define ROF(i,a,b) for(int i=(a);i>=(b);i--) #define MEM(x,v) memset(x,v,sizeof(x)) inline int read(){ char ch=getchar();int x=0,f=0; while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar(); while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar(); return f?-x:x; } inline int qpow(int a,int b){ int ans=1; for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod; return ans; } int n,a[maxn],x=1,y=2; int main(){ n=read(); FOR(i,1,n){ int op=read(),p=read(); if(op==1){ a[p]=1; while(a[x]) x++; while(a[y] || y==x) y++; } else printf("%d\n",p==x?y:x); } }