/* * @Author: your name * @Date: 2021-07-31 13:35:46 * @LastEditTime: 2021-07-31 15:16:13 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \vscode\summer holiday\comportation\baidu\C.cpp */ #include #include #include #include #include #include #include #include #include #include #include #define mem(a,n) memset(a,n,sizeof a) #define endl '\n' #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define SYS system("pause"); using namespace std; typedef long long ll; typedef pair PII; ll gcd(ll a,ll b){ll d; while(b){ d=b; b=a%b; a=d; } return a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; } return ans;} ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; } return ans;} void exgcd(int a,int b,int &x,int &y){ if(b==0){ x=1;y=0;return; } exgcd(b,a%b,x,y); int temp=y; y=x-(a/b)*y, x=temp; return;} int downcheck(int l, int r){ while (l < r){ int mid = l + r >> 1; if ("check(mid)") r = mid; else l = mid + 1; } return l;} int upcheck(int l, int r){ while (l < r){ int mid = l + r + 1 >> 1; if ("check(mid)") l = mid; else r = mid - 1;} return l;} int doublecheck(int l,int r){ while(r-l>1e-8){ int mid=(l+r)>>1; if("check(mid)") l=mid; else r=mid;} return l; } const int N = 5e6+10,M=20; const int inf=0x3f3f3f3f; const int mod=1e9+7; const double pi = acos(-1.0); int n,t,m,x; int ans[N]; int main(){ IOS cin>>n; t = n; int cnt1 = 1, cnt2 = 2; while(t--){ int a, b; cin >> a >> b; if(a==1){ ans[b] = 1; if(b==cnt1){ cnt1 = cnt2; cnt2 += 1; while(ans[cnt2]==1&&cnt2<=n+1) cnt2++; } if(b==cnt2){ cnt2 += 1; while(ans[cnt2]==1&&cnt2<=n+1) cnt2++; } } else{ if(b==cnt1) cout << cnt2 << endl; else cout << cnt1 << endl; } } //SYS return 0; }