#include using namespace std; const int maxn = 5e6; int n; int fa[maxn + 10], a[maxn + 10]; int getf(int p) { return fa[p] == p ? p : fa[p] = getf(fa[p]); } int read() { int x = 0; char c = getchar(); while (c < '0' || c > '9') c = getchar(); while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); } return x; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) fa[i] = i; while (n--) { int op = read(); int x = read(); if (op == 1) { if (a[x] == 1) continue; a[x] = 1; if (a[x - 1] == 1) fa[getf(x - 1)] = x; if (a[x + 1] == 1) fa[getf(x)] = x + 1; } else { int w = a[1] ? getf(1) : 0; if (w + 1 == x) { w += 2; w = a[w] ? getf(w) : w - 1; } printf("%d\n", w + 1); } } }