#include #include #include #include #include using namespace std; bool B[5000010]; int main() { int n; scanf("%d", &n); int pt0 = 1, pt1 = 2; for(int i = 1; i <= n; i++) { int op, x; scanf("%d%d", &op, &x); if(op == 1) { int flag = B[x]; B[x] = 1; while(B[pt0] && pt0 <= n) pt0++; if(x == pt1) while(B[pt1] && pt1 <= n) pt1++; else if(!flag && x < pt1) {pt1++; while(B[pt1] && pt1 <= n) pt1++;} } else { if(x == pt0) printf("%d\n", pt1); else printf("%d\n", pt0); } } }