#pragma GCC optimize(2) #include #define all(n) (n).begin(), (n).end() #define se second #define fi first #define pb emplace_back #define mp make_pair #define sqr(n) ((n)*(n)) #define rep(i, a, b) for (int i = (a); i <= (b); ++i) #define per(i, a, b) for (int i = (a); i >= (b); --i) #define precision(a) setiosflags(ios::fixed) << setprecision(a) #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair PII; typedef pair PLL; typedef vector VI; typedef vector VL; typedef double db; template char read(T &x) { x = 0; T fg = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') fg = -1;ch = getchar();} while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ '0'), ch = getchar(); x = fg * x; return ch; } template void read(T &x, Args &... args) { read(x), read(args...); } template void write(T x) { int len = 0; char c[40]; if (x < 0) putchar('-'), x = -x; do{++len; c[len] = x % 10 + '0';} while (x /= 10); for (int i = len; i >= 1; i--) putchar(c[i]); } template void write(T& x, Args &... args) { write(x), write(args...); } template bool umin(T1& a, T2 b) { return a > b ? (a = b, true) : false; } template bool umax(T1& a, T2 b) { return a < b ? (a = b, true) : false; } template void clear(T& a) { T().swap(a); } const int N = 5e6 + 5; int n, m, _, k, cas; int a[N], s1 = 1, s2 = 2; void movs2() { while (a[s2]) ++s2; } void movs1() { while (a[s1])++s1; if (s1 == s2) { s2++; movs2(); } } int main(){ IOS; cin >> n; while(n--) { int c, d; cin >> c >> d; if (c == 1) { a[d] = 1; if (d == s1) movs1(); if (d == s2) movs2(); } else if (d == s1) cout << s2 << '\n'; else cout << s1 << '\n'; } }