#include using namespace std; int f[5000005] = {0}; int main() { int t; cin >> t; int mx = 0; for(int len = 1;len <= t;len++){ int a,b; scanf("%d%d",&a,&b); if(a == 2){ int flag; int mxx = mx; if(f[b]){ flag = 1; }else{ flag = 0; f[b] = 1; } for(int i = mx + 1;i <= t;i++){ if(f[i] == 1){ mx++; }else{ break; } } printf("%d\n",mx + 1); if(flag == 0){ f[b] = 0; mx = mxx; } }else{ f[b] = 1; } } return 0; }