#include using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n + 2, 1); int b = 0; int c = 1; for (int i = 0; i < n; i++) { int op, x; cin >> op >> x; x--; if (op == 1) { if (a[x]) { a[x] = 0; } if (b == x) { b = c; c++; while (!a[c]) { c++; } } else if (c == x) { c++; while (!a[c]) { c++; } } } else { if (b == x) { cout << c + 1 << '\n'; } else { cout << b + 1 << '\n'; } } } return 0; }