#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
const int N = 100006;
const int nein = -1;

struct qr {
    ll o, l, r;
};

vector<ll> vals;
vector<qr> q;

struct Segment_Tree {

    vector<int> val, lazy;
    int size;

    void init(int x) {
        size = 1;
        while(size < x) size *= 2;
        val.resize(size * 2);
        lazy.resize(size * 2);
    }

    void propagate(int node, int l, int r) {

        if (l == r - 1) {
            lazy[node] = nein;
            return;
        }

        if (lazy[node] == nein) {
            return;
        }

        int mid = (l + r) / 2;
        for(int x : {2 * node + 1, 2 * node + 2}) {

               if (lazy[node] == 0) {
                    val[x] = 0;
                    lazy[x] = 0;
               }

               if (lazy[node] == 1) {
                    val[x] = mid - l;
                    lazy[x] = 1;
               }

               if (lazy[node] == 2) {
                    val[x] = mid - l - val[x];
                    lazy[x] = 1 - lazy[x];
               }
        }

        lazy[node] = nein;

    }
    int merge(int a, int b) {
        return a + b;
    }

    void add(int node, int l, int r, int lf, int rg, int x) {

        propagate(node, l, r);

        if (r <= lf || l >= rg) return;

        if (l >= lf && r <= rg) {
            val[node] = x * (r - l);
            lazy[node] = x;
            return;
        }

        int mid = (l + r) / 2;

        add(node * 2 + 1, l, mid, lf, rg, x);
        add(node * 2 + 2, mid, r, lf, rg, x);

        val[node] = merge(val[node * 2 + 1], val[node * 2 + 2]);

    }

    void add(int l, int r, int x) {
        add(0, 0, size, l, r, x);
    }

    void rev(int node, int l, int r, int lf, int rg) {

        propagate(node, l, r);

        if (r <= lf || l >= rg) return;

        if (l >= lf && r <= rg) {
            val[node] = r - l - val[node];
            if (lazy[node] == -1) lazy[node] = 2; else lazy[node] = 1 - lazy[node];
            return;
        }

        int mid = (l + r) / 2;

        rev(node * 2 + 1, l, mid, lf, rg);
        rev(node * 2 + 2, mid, r, lf, rg);

        val[node] = merge(val[node * 2 + 1], val[node * 2 + 2]);

    }

    void rev(int l, int r) {
        rev(0, 0, size, l, r);
    }

    int get(int node, int l, int r) {

        propagate(node, l, r);
        if (val[node] == r - l) return -1;
        if (l == r - 1) {
            return l;
        }

        int mid = (l + r) / 2;
        int ans = get(node * 2 + 1, l, mid);
        if (ans == -1) ans = get(node * 2 + 2, mid, r);

        return ans;

    }

    int get() {
        return get(0, 0, size);
    }

};
int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    for(int i = 1; i <= n; i++) {
        ll op, x, y;
        cin >> op >> x >> y;
        q.pb(qr{op, x, y});
        vals.pb(x);
        vals.pb(y);
        vals.pb(y + 1);
    }

    vals.pb(1);
    sort(vals.begin(), vals.end());
    vals.erase(unique(vals.begin(), vals.end()), vals.end());

    for(int i = 1; i <= n; i++) {

        q[i - 1].l = lower_bound(vals.begin(), vals.end(), q[i - 1].l) - vals.begin();
        q[i - 1].r = lower_bound(vals.begin(), vals.end(), q[i - 1].r) - vals.begin();

    }

    Segment_Tree st;
    st.init(6 * n);

    for(auto it : q) {

        // cout << it.l << ' ' << it.r << '\n';

        if (it.o == 1) {
            st.add(it.l, it.r + 1, 1);
        } else if (it.o == 2) {
            st.add(it.l, it.r + 1, 0);
        } else if (it.o == 3) {
            st.rev(it.l, it.r + 1);
        }

        // cout << st.val[0] << '\n';
        //cout << st.get() << '\n';
        // cout << "ska\n";
        cout << vals[st.get()] << '\n';

    }
    return 0;
}

// 5
// 3 1 4
// 3 1 4
// 1 1 2
// 1 1 2
// 3 1 2

// 5
// 5
// 5
// 5
// 1


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100000;

pair<int, pair<int, int> > query[N];

pair<long long, int> val[N * 4];
long long a[N * 4 + 1];

struct SegmentTree {
	vector<pair<bool, int> > t;
	vector<int> upd;
	SegmentTree(int n) {
		t.resize(1 << (33 - __builtin_clz(n - 1)), make_pair(false, -1));
		upd.resize(1 << (33 - __builtin_clz(n - 1)));
	}
	void push(int v, int tl, int tr);
	void update(int v, int tl, int tr, int l, int r, int val);
};
void SegmentTree::push(int v, int tl, int tr)
{
	if (upd[v]) {
		if (upd[v] == 1) {
			t[v].first = true;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 1;
			}
		}
		else if (upd[v] == 2) {
			t[v].first = false;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 2;
			}
		}
		else {
			t[v].first = !t[v].first;
			if (tl - tr) {
				for (int s = v * 2 + 1; s <= v * 2 + 2; ++s) {
					if (!upd[s]) upd[s] = 3;
					else if (upd[s] == 1) upd[s] = 2;
					else if (upd[s] == 2) upd[s] = 1;
					else upd[s] = 0;
				}
			}
		}
		upd[v] = 0;
	}
}
void SegmentTree::update(int v, int tl, int tr, int l, int r, int val)
{
	if (tl > r || tr < l) push(v, tl, tr);
	else if (tl >= l && tr <= r) {
		upd[v] = val;
		push(v, tl, tr);
	}
	else {
		push(v, tl, tr);
		update(v * 2 + 1, tl, (tl + tr) / 2, l, r, val);
		update(v * 2 + 2, (tl + tr) / 2 + 1, tr, l, r, val);
		// printf("$%d %d %d\n", v, tl, tr);
		// printf("get from %d %d, %d %d\n", (int)t[v * 2 + 1].first, t[v * 2 + 1].second, (int)t[v * 2 + 2].first, t[v * 2 + 2].second);
		t[v].first = t[v * 2 + 1].first;
		if (t[v * 2 + 1].second != -1) t[v].second = t[v * 2 + 1].second;
		else if (t[v * 2 + 2].first != t[v].first) t[v].second = (tr - tl) / 2 + 1;
		else if (t[v * 2 + 2].second != -1) t[v].second = (tr - tl) / 2 + 1 + t[v * 2 + 2].second;
		else t[v].second = -1;
		// printf("got %d %d\n", (int)t[v].first, t[v].second);
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		query[i].second.first = query[i].second.second = -1;
		scanf("%d%lld%lld", &query[i].first, &val[i * 4].first, &val[i * 4 + 1].first);
		val[i * 4].second = val[i * 4 + 1].second = i;
		val[i * 4 + 2].second = val[i * 4 + 3].second = -1;
		val[i * 4 + 2].first = val[i * 4].first + 1;
		val[i * 4 + 3].first = val[i * 4 + 1].first + 1;

	}
	sort(val, val + n * 4);
	int size = 0;
	a[0] = val[0].first;
	for (int i = 0; i < n * 4; ++i) {
		if (val[i].first != a[size]) {
			++size;
			a[size] = val[i].first;
		}
		if (val[i].second != -1) {
			if (query[val[i].second].second.first != -1) query[val[i].second].second.second = size;
			else query[val[i].second].second.first = size;
		}
	}
	++size;
	SegmentTree tr(size);
	for (int i = 0; i < n; ++i) {
		tr.update(0, 0, size - 1, query[i].second.first, query[i].second.second, query[i].first);
		if (!tr.t[0].first) printf("%d\n", 1);
		else printf("%lld\n", a[tr.t[0].second]);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100000;

pair<int, pair<int, int> > query[N];

pair<long long, int> val[N * 4 + 1];
long long a[N * 4 + 1];

struct SegmentTree {
	vector<pair<bool, int> > t;
	vector<int> upd;
	SegmentTree(int n) {
		t.resize(1 << (33 - __builtin_clz(n - 1)), make_pair(false, -1));
		upd.resize(1 << (33 - __builtin_clz(n - 1)));
	}
	void push(int v, int tl, int tr);
	void update(int v, int tl, int tr, int l, int r, int val);
};
void SegmentTree::push(int v, int tl, int tr)
{
	if (upd[v]) {
		if (upd[v] == 1) {
			t[v].first = true;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 1;
			}
		}
		else if (upd[v] == 2) {
			t[v].first = false;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 2;
			}
		}
		else {
			t[v].first = !t[v].first;
			if (tl - tr) {
				for (int s = v * 2 + 1; s <= v * 2 + 2; ++s) {
					if (!upd[s]) upd[s] = 3;
					else if (upd[s] == 1) upd[s] = 2;
					else if (upd[s] == 2) upd[s] = 1;
					else upd[s] = 0;
				}
			}
		}
		upd[v] = 0;
	}
}
void SegmentTree::update(int v, int tl, int tr, int l, int r, int val)
{
	push(v, tl, tr);
	if (tl > r || tr < l) return;
	if (tl >= l && tr <= r) {
		upd[v] = val;
		push(v, tl, tr);
	}
	else {
		update(v * 2 + 1, tl, (tl + tr) / 2, l, r, val);
		update(v * 2 + 2, (tl + tr) / 2 + 1, tr, l, r, val);
		t[v].first = t[v * 2 + 1].first;
		if (t[v * 2 + 1].second != -1) t[v].second = t[v * 2 + 1].second;
		else if (t[v * 2 + 2].first != t[v].first) t[v].second = (tr - tl) / 2 + 1;
		else if (t[v * 2 + 2].second != -1) t[v].second = (tr - tl) / 2 + 1 + t[v * 2 + 2].second;
		else t[v].second = -1;
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		query[i].second.first = query[i].second.second = -1;
		scanf("%d%lld%lld", &query[i].first, &val[i * 4].first, &val[i * 4 + 1].first);
		val[i * 4].second = val[i * 4 + 1].second = i;
		val[i * 4 + 2].second = val[i * 4 + 3].second = -1;
		val[i * 4 + 2].first = val[i * 4].first + 1;
		val[i * 4 + 3].first = val[i * 4 + 1].first + 1;

	}
	sort(val, val + n * 4);
	int size = 0;
	a[0] = 1;
	for (int i = 0; i < n * 4; ++i) {
		if (val[i].first != a[size]) {
			++size;
			a[size] = val[i].first;
		}
		if (val[i].second != -1) {
			if (query[val[i].second].second.first != -1) query[val[i].second].second.second = size;
			else query[val[i].second].second.first = size;
		}
	}
	++size;
	SegmentTree tr(size);
	for (int i = 0; i < n; ++i) {
		tr.update(0, 0, size - 1, query[i].second.first, query[i].second.second, query[i].first);
		if (!tr.t[0].first) printf("%d\n", 1);
		else printf("%lld\n", a[tr.t[0].second]);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100000;

pair<int, pair<int, int> > query[N];

pair<long long, int> val[N * 2];
long long a[N * 2 + 1];

struct SegmentTree {
	vector<pair<bool, int> > t;
	vector<int> upd;
	SegmentTree(int n) {
		t.resize(1 << (33 - __builtin_clz(n - 1)), make_pair(false, -1));
		upd.resize(1 << (33 - __builtin_clz(n - 1)));
	}
	void push(int v, int tl, int tr);
	void update(int v, int tl, int tr, int l, int r, int val);
};
void SegmentTree::push(int v, int tl, int tr)
{
	if (upd[v]) {
		if (upd[v] == 1) {
			t[v].first = true;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 1;
			}
		}
		else if (upd[v] == 2) {
			t[v].first = false;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 2;
			}
		}
		else {
			t[v].first = !t[v].first;
			if (tl - tr) {
				for (int s = v * 2 + 1; s <= v * 2 + 2; ++s) {
					if (!upd[s]) upd[s] = 3;
					else if (upd[s] == 1) upd[s] = 2;
					else if (upd[s] == 2) upd[s] = 1;
					else upd[s] = 0;
				}
			}
		}
		upd[v] = 0;
	}
}
void SegmentTree::update(int v, int tl, int tr, int l, int r, int val)
{
	if (tl > r || tr < l) push(v, tl, tr);
	else if (tl >= l && tr <= r) {
		upd[v] = val;
		push(v, tl, tr);
	}
	else {
		push(v, tl, tr);
		update(v * 2 + 1, tl, (tl + tr) / 2, l, r, val);
		update(v * 2 + 2, (tl + tr) / 2 + 1, tr, l, r, val);
		t[v].first = t[v * 2 + 1].first;
		if (t[v * 2 + 1].second != -1) t[v].second = t[v * 2 + 1].second;
		else if (t[v * 2 + 2].first != t[v].first) t[v].second = (tr - tl) / 2 + 1;
		else if (t[v * 2 + 2].second != -1) t[v].second = (tr - tl) / 2 + 1 + t[v * 2 + 2].second;
		else t[v].second = -1;
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		query[i].second.first = query[i].second.second = -1;
		scanf("%d%lld%lld", &query[i].first, &val[i * 2].first, &val[i * 2 + 1].first);
		val[i * 2].second = val[i * 2 + 1].second = i;
	}
	sort(val, val + n * 2);
	int size = 0;
	a[0] = val[0].first;
	for (int i = 0; i < n * 2; ++i) {
		if (val[i].first != a[size]) {
			++size;
			a[size] = val[i].first;
		}
		if (query[val[i].second].second.first != -1) query[val[i].second].second.second = size;
		else query[val[i].second].second.first = size;
	}
	a[size + 1] = val[n * 2 - 1].first + 1;
	size += 2;
	SegmentTree tr(size);
	for (int i = 0; i < n; ++i) {
		tr.update(0, 0, size - 1, query[i].second.first, query[i].second.second, query[i].first);
		if (!tr.t[0].first) printf("%d\n", 1);
		else printf("%lld\n", a[tr.t[0].second]);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100000;

pair<int, pair<int, int> > query[N];

pair<long long, int> val[N * 2];
long long a[N * 2 + 1];

struct SegmentTree {
	vector<pair<bool, int> > t;
	vector<int> upd;
	SegmentTree(int n) {
		t.resize(1 << (33 - __builtin_clz(n - 1)), make_pair(false, -1));
		upd.resize(1 << (33 - __builtin_clz(n - 1)));
	}
	void push(int v, int tl, int tr);
	void update(int v, int tl, int tr, int l, int r, int val);
};
void SegmentTree::push(int v, int tl, int tr)
{
	if (upd[v]) {
		if (upd[v] == 1) {
			t[v].first = true;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 1;
			}
		}
		else if (upd[v] == 2) {
			t[v].first = false;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 2;
			}
		}
		else {
			t[v].first = !t[v].first;
			if (tl - tr) {
				for (int s = v * 2 + 1; s <= v * 2 + 2; ++s) {
					if (!upd[s]) upd[s] = 3;
					else if (upd[s] == 1) upd[s] = 2;
					else if (upd[s] == 2) upd[s] = 1;
					else upd[s] = 0;
				}
			}
		}
	}
}
void SegmentTree::update(int v, int tl, int tr, int l, int r, int val)
{
	if (tl > r || tr < l) push(v, tl, tr);
	else if (tl >= l && tr <= r) {
		upd[v] = val;
		push(v, tl, tr);
	}
	else {
		push(v, tl, tr);
		update(v * 2 + 1, tl, (tl + tr) / 2, l, r, val);
		update(v * 2 + 2, (tl + tr) / 2 + 1, tr, l, r, val);
		t[v].first = t[v * 2 + 1].first;
		if (t[v * 2 + 1].second != -1) t[v].second = t[v * 2 + 1].second;
		else if (t[v * 2 + 2].first != t[v].first) t[v].second = (tr - tl) / 2 + 1;
		else if (t[v * 2 + 2].second != -1) t[v].second = (tr - tl) / 2 + 1 + t[v * 2 + 2].second;
		else t[v].second = -1;
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		query[i].second.first = query[i].second.second = -1;
		scanf("%d%lld%lld", &query[i].first, &val[i * 2].first, &val[i * 2 + 1].first);
		val[i * 2].second = val[i * 2 + 1].second = i;
	}
	sort(val, val + n * 2);
	int size = 0;
	a[0] = val[0].first;
	for (int i = 0; i < n * 2; ++i) {
		if (val[i].first != a[size]) {
			++size;
			a[size] = val[i].first;
		}
		if (query[val[i].second].second.first != -1) query[val[i].second].second.second = size;
		else query[val[i].second].second.first = size;
	}
	a[size + 1] = val[n * 2 - 1].first + 1;
	size += 2;
	SegmentTree tr(size);
	for (int i = 0; i < n; ++i) {
		tr.update(0, 0, size - 1, query[i].second.first, query[i].second.second, query[i].first);
		if (!tr.t[0].first) printf("%d\n", 1);
		else printf("%lld\n", a[tr.t[0].second]);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100000;

pair<int, pair<int, int> > query[N];

pair<long long, int> val[N * 4];
long long a[N * 4 + 1];

struct SegmentTree {
	vector<pair<bool, int> > t;
	vector<int> upd;
	SegmentTree(int n) {
		t.resize(1 << (33 - __builtin_clz(n - 1)), make_pair(false, -1));
		upd.resize(1 << (33 - __builtin_clz(n - 1)));
	}
	void push(int v, int tl, int tr);
	void update(int v, int tl, int tr, int l, int r, int val);
};
void SegmentTree::push(int v, int tl, int tr)
{
	if (upd[v]) {
		if (upd[v] == 1) {
			t[v].first = true;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 1;
			}
		}
		else if (upd[v] == 2) {
			t[v].first = false;
			t[v].second = -1;
			if (tl - tr) {
				upd[v * 2 + 1] = upd[v * 2 + 2] = 2;
			}
		}
		else {
			t[v].first = !t[v].first;
			if (tl - tr) {
				for (int s = v * 2 + 1; s <= v * 2 + 2; ++s) {
					if (!upd[s]) upd[s] = 3;
					else if (upd[s] == 1) upd[s] = 2;
					else if (upd[s] == 2) upd[s] = 1;
					else upd[s] = 0;
				}
			}
		}
		upd[v] = 0;
	}
}
void SegmentTree::update(int v, int tl, int tr, int l, int r, int val)
{
	push(v, tl, tr);
	if (tl > r || tr < l) return;
	if (tl >= l && tr <= r) {
		upd[v] = val;
		push(v, tl, tr);
	}
	else {
		update(v * 2 + 1, tl, (tl + tr) / 2, l, r, val);
		update(v * 2 + 2, (tl + tr) / 2 + 1, tr, l, r, val);
		t[v].first = t[v * 2 + 1].first;
		if (t[v * 2 + 1].second != -1) t[v].second = t[v * 2 + 1].second;
		else if (t[v * 2 + 2].first != t[v].first) t[v].second = (tr - tl) / 2 + 1;
		else if (t[v * 2 + 2].second != -1) t[v].second = (tr - tl) / 2 + 1 + t[v * 2 + 2].second;
		else t[v].second = -1;
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		query[i].second.first = query[i].second.second = -1;
		scanf("%d%lld%lld", &query[i].first, &val[i * 4].first, &val[i * 4 + 1].first);
		val[i * 4].second = val[i * 4 + 1].second = i;
		val[i * 4 + 2].second = val[i * 4 + 3].second = -1;
		val[i * 4 + 2].first = val[i * 4].first + 1;
		val[i * 4 + 3].first = val[i * 4 + 1].first + 1;

	}
	sort(val, val + n * 4);
	int size = 0;
	a[0] = val[0].first;
	for (int i = 0; i < n * 4; ++i) {
		if (val[i].first != a[size]) {
			++size;
			a[size] = val[i].first;
		}
		if (val[i].second != -1) {
			if (query[val[i].second].second.first != -1) query[val[i].second].second.second = size;
			else query[val[i].second].second.first = size;
		}
	}
	++size;
	SegmentTree tr(size);
	for (int i = 0; i < n; ++i) {
		tr.update(0, 0, size - 1, query[i].second.first, query[i].second.second, query[i].first);
		if (!tr.t[0].first) printf("%d\n", 1);
		else printf("%lld\n", a[tr.t[0].second]);
	}
	return 0;
}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'

using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 200001

lli seg[4*N],lazy[4*N];

void update(lli n,lli st,lli en,lli l,lli r,lli val)
{
    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>en || l>en || st>r) return ;

    if(l<=st && r>=en)
    {
        if(val == 1) seg[n]=en-st+1;
        if(val == 2) seg[n]=0;
        if(val == 3) seg[n]=en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = val;
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = val;
            }

        }
        return ;
    }

    lli mid = (st+en)/2;
    update(2*n,st,mid,l,r,val);
    update(2*n + 1,mid+1,en,l,r,val);
    seg[n] = seg[2*n] + seg[2*n + 1];
}

lli query(lli n,lli st,lli en,lli l,lli r)
{
    if(st>en || en<l || r<st) return 0;

    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>=l && en<=r)
        return seg[n];
    lli mid = (st+en)/2;
    lli q1 = query(2*n,st,mid,l,r);
    lli q2 = query(2*n + 1,mid+1,en,l,r);

    return q1+q2;

}

int main()
{

//////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
//////////////////////////////////////////////

    loopl(i,0,4*N) lazy[i]=-10;

    lli n;
    cin>>n;

    pair<lli,pll> q[n];

    //////////////////////////////////////////////////////COMPRESS

    loopl(i,0,n)
    {
        lli a,b,c;
        cin>>a>>b>>c;

        q[i] = {a,{b,c}};

    }

     map<lli,lli> ma;
        ma[1]=1;

        loopl(i,0,n)
        {
            ma[q[i].ss.ff]=1;
            ma[q[i].ss.ss+1]=1;
        }

        vll v;
        v.pb(-10);

        for(auto i:ma) v.pb(i.ff);
        loopl(i,0,v.size()) ma[v[i]]=i;

    /////////////////////////////////////////////////////////

    loopl(i,0,n)
        {
            lli t=q[i].ff;
            lli l=q[i].ss.ff;
            lli r=q[i].ss.ss;

            update(1,1,v.size()-1,ma[l],ma[r+1]-1,t);
            lli low=1,high=v.size()-1,ans=-1;

            while(low<=high)
            {
                // break;
                lli mid=(low+high)/2;
                if(query(1,1,v.size()-1,1,mid)!=mid)
                {
                    ans=mid;
                    high=mid-1;
                }
                else
                {
                    low=mid+1;
                }
            }
            cout<<v[ans]<<endl;
        }

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'

using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 100001

lli seg[4*N],lazy[4*N];

void update(lli n,lli st,lli en,lli l,lli r,lli val)
{
    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>en || l>en || st>r) return ;

    if(l<=st && r>=en)
    {
        if(val == 1) seg[n]=en-st+1;
        if(val == 2) seg[n]=0;
        if(val == 3) seg[n]=en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = val;
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = val;
            }

        }
        return ;
    }

    lli mid = (st+en)/2;
    update(2*n,st,mid,l,r,val);
    update(2*n + 1,mid+1,en,l,r,val);
    seg[n] = seg[2*n] + seg[2*n + 1];
}

lli query(lli n,lli st,lli en,lli l,lli r)
{
    if(st>en || en<l || r<st) return 0;

    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>=l && en<=r)
        return seg[n];
    lli mid = (st+en)/2;
    lli q1 = query(2*n,st,mid,l,r);
    lli q2 = query(2*n + 1,mid+1,en,l,r);

    return q1+q2;

}

int main()
{

//////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
//////////////////////////////////////////////

    loopl(i,0,4*N) lazy[i]=-10;

    lli n;
    cin>>n;

    pair<lli,pll> q[n];

    //////////////////////////////////////////////////////COMPRESS
    map<lli,lli> m,occ;
    m[1]=1;
    vll v;
    v.pb(-10);

    loopl(i,0,n)
    {
        lli a,b,c;
        cin>>a>>b>>c;

        q[i] = {a,{b,c}};

        if(occ[b] == 0)
        {
            occ[b]++;
            v.pb(b);
        }

        if(occ[c+1] == 0)
        {
            occ[c+1]++;
            v.pb(c+1);
        }
    }

    sort(v.begin(),v.end());

    loopl(i,1,v.size())
        m[v[i]] = i;

    /////////////////////////////////////////////////////////

    loopl(i,0,n)
        {
            lli t=q[i].ff;
            lli l=q[i].ss.ff;
            lli r=q[i].ss.ss;

            update(1,1,v.size()-1,m[l],m[r+1]-1,t);
            lli low=1,high=v.size()-1,ans=-1;

            while(low<=high)
            {
                // break;
                lli mid=(low+high)/2;
                if(query(1,1,v.size()-1,1,mid)!=mid)
                {
                    ans=mid;
                    high=mid-1;
                }
                else
                {
                    low=mid+1;
                }
            }
            cout<<v[ans]<<endl;
        }

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'

using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 100001

lli seg[4*N],lazy[4*N];

void update(lli n,lli st,lli en,lli l,lli r,lli val)
{
    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>en || l>en || st>r) return ;

    if(l<=st && r>=en)
    {
        if(val == 1) seg[n]=en-st+1;
        if(val == 2) seg[n]=0;
        if(val == 3) seg[n]=en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = val;
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = val;
            }

        }
        return ;
    }

    lli mid = (st+en)/2;
    update(2*n,st,mid,l,r,val);
    update(2*n + 1,mid+1,en,l,r,val);
    seg[n] = seg[2*n] + seg[2*n + 1];
}

lli query(lli n,lli st,lli en,lli l,lli r)
{
    if(st>en || en<l || r<st) return 0;

    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>=l && en<=r)
        return seg[n];
    lli mid = (st+en)/2;
    lli q1 = query(2*n,st,mid,l,r);
    lli q2 = query(2*n + 1,mid+1,en,l,r);

    return q1+q2;

}

int main()
{

//////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
//////////////////////////////////////////////

    memset(lazy,-10,sizeof(lazy));

    lli n;
    cin>>n;

    pair<lli,pll> q[n];

    //////////////////////////////////////////////////////COMPRESS
    map<lli,lli> m,occ;

    vll v;

    loopl(i,0,n)
    {
        lli a,b,c;
        cin>>a>>b>>c;

        q[i] = {a,{b,c}};

        if(occ[b] == 0)
        {
            occ[b]++;
            v.pb(b);
        }

        if(occ[c] == 0)
        {
            occ[c]++;
            v.pb(c);
        }
    }

    sort(v.begin(),v.end());

    loopl(i,0,v.size())
        m[v[i]] = i+1;

    /////////////////////////////////////////////////////////

    loopl(i,0,n)
    {
        lli t=q[i].ff,l=m[q[i].ss.ff],r=m[q[i].ss.ss];
        update(1,1,n,l,r,t);

        lli lo=1,hi=v.size();

        while(lo<=hi)
        {
            lli mid=(lo+hi)/2;

            if(query(1,1,v.size(),1,mid)!=mid)
            {
               // ans=mid;
                hi=mid-1;
            }

            else
            lo=mid+1;
        }

        cout<<v[lo-1]<<endl;
    }

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'

using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 100001

lli seg[4*N],lazy[4*N];

void update(lli n,lli st,lli en,lli l,lli r,lli val)
{
    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>en || l>en || st>r) return ;

    if(l<=st && r>=en)
    {
        if(val == 1) seg[n]=en-st+1;
        if(val == 2) seg[n]=0;
        if(val == 3) seg[n]=en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = val;
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = val;
            }

        }
        return ;
    }

    lli mid = (st+en)/2;
    update(2*n,st,mid,l,r,val);
    update(2*n + 1,mid+1,en,l,r,val);
    seg[n] = seg[2*n] + seg[2*n + 1];
}

lli query(lli n,lli st,lli en,lli l,lli r)
{
    if(st>en || en<l || r<st) return 0;

    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>=l && en<=r)
        return seg[n];
    lli mid = (st+en)/2;
    lli q1 = query(2*n,st,mid,l,r);
    lli q2 = query(2*n + 1,mid+1,en,l,r);

    return q1+q2;

}

int main()
{

//////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
//////////////////////////////////////////////

    memset(lazy,-10,sizeof(lazy));

    lli n;
    cin>>n;

    pair<lli,pll> q[n];

    //////////////////////////////////////////////////////COMPRESS
    map<lli,lli> m,occ;

    vll v;

    loopl(i,0,n)
    {
        lli a,b,c;
        cin>>a>>b>>c;

        q[i] = {a,{b,c}};

        if(occ[b] == 0)
        {
            occ[b]++;
            v.pb(b);
        }

        if(occ[c] == 0)
        {
            occ[c]++;
            v.pb(c);
        }
    }

    sort(v.begin(),v.end());

    loopl(i,0,v.size())
        m[v[i]] = i+1;

    /////////////////////////////////////////////////////////

    loopl(i,0,n)
    {
        lli t=q[i].ff,l=m[q[i].ss.ff],r=m[q[i].ss.ss];
        update(1,1,v.size(),l,r,t);

        lli lo=1,hi=N;

        while(lo<=hi)
        {
            lli mid=(lo+hi+1)/2;
           // cout<<1<<" ";
            if(query(1,1,v.size(),1,mid)!=mid)
            {
               // cout<<mid<<" hh "<<endl;
               // ans=mid;
                hi=mid-1;
            }

            else
            lo=mid+1;
        }

        if(lo <= v.size())
        cout<<v[lo-1]<<endl;

        else
            cout<<v[v.size()-1]+1<<endl;
    }

}


#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 1000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'

using namespace std ;

typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;

#define N 200001

lli seg[4*N],lazy[4*N];

void update(lli n,lli st,lli en,lli l,lli r,lli val)
{
    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>en || l>en || st>r) return ;

    if(l<=st && r>=en)
    {
        if(val == 1) seg[n]=en-st+1;
        if(val == 2) seg[n]=0;
        if(val == 3) seg[n]=en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = val;
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = val;

            else
            {
                if(val == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = val;
            }

        }
        return ;
    }

    lli mid = (st+en)/2;
    update(2*n,st,mid,l,r,val);
    update(2*n + 1,mid+1,en,l,r,val);
    seg[n] = seg[2*n] + seg[2*n + 1];
}

lli query(lli n,lli st,lli en,lli l,lli r)
{
    if(st>en || en<l || r<st) return 0;

    if(lazy[n]!=-10)
    {
        if(lazy[n] == 1) seg[n] = en-st+1;
        if(lazy[n] == 2) seg[n] = 0;
        if(lazy[n] == 3) seg[n] = en-st+1-seg[n];

        if(st!=en)
        {
            if(lazy[2*n] == -10)
                lazy[2*n] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n] == 3) lazy[2*n]=-10;
                    else lazy[2*n]=3-lazy[2*n];
                }

                else
                    lazy[2*n] = lazy[n];
            }

            if(lazy[2*n + 1] == -10)
                lazy[2*n + 1] = lazy[n];

            else
            {
                if(lazy[n] == 3)
                {
                    if(lazy[2*n + 1] == 3) lazy[2*n + 1]=-10;
                    else lazy[2*n + 1]=3-lazy[2*n + 1];
                }

                else
                    lazy[2*n + 1] = lazy[n];
            }
        }

        lazy[n] = -10;

    }

    if(st>=l && en<=r)
        return seg[n];
    lli mid = (st+en)/2;
    lli q1 = query(2*n,st,mid,l,r);
    lli q2 = query(2*n + 1,mid+1,en,l,r);

    return q1+q2;

}

int main()
{

//////////////////////////////////////////////
    fastio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);
    #endif
//////////////////////////////////////////////

    loopl(i,0,4*N) lazy[i]=-10;

    lli n;
    cin>>n;

    pair<lli,pll> q[n];

    //////////////////////////////////////////////////////COMPRESS
    map<lli,lli> m,occ;
    m[1]=1;
    vll v;
    v.pb(-10);

    loopl(i,0,n)
    {
        lli a,b,c;
        cin>>a>>b>>c;

        q[i] = {a,{b,c}};

        if(occ[b] == 0)
        {
            occ[b]++;
            v.pb(b);
        }

        if(occ[c+1] == 0)
        {
            occ[c+1]++;
            v.pb(c+1);
        }
    }

    sort(v.begin(),v.end());

    loopl(i,1,v.size())
        m[v[i]] = i;

    /////////////////////////////////////////////////////////

    loopl(i,0,n)
        {
            lli t=q[i].ff;
            lli l=q[i].ss.ff;
            lli r=q[i].ss.ss;

            update(1,1,v.size()-1,m[l],m[r+1]-1,t);
            lli low=1,high=v.size()-1,ans=-1;

            while(low<=high)
            {
                // break;
                lli mid=(low+high)/2;
                if(query(1,1,v.size()-1,1,mid)!=mid)
                {
                    ans=mid;
                    high=mid-1;
                }
                else
                {
                    low=mid+1;
                }
            }
            cout<<v[ans]<<endl;
        }

}


#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second

typedef long long ll;
typedef long double ld;

const int maxn = 6e5+10;
const int mod = 998244353;
const int inf = 1e9;

int n, m;

int la[4*maxn], is[4*maxn];
int seg0[4*maxn], seg1[4*maxn];

void build(int v = 1, int tl = 0, int tr = n-1)
{
    is[v] = -1;
    seg0[v] = tl;
    seg1[v] = inf;

    if(tl == tr) return;

    int tm = (tl + tr) >> 1;
    build(v<<1, tl, tm);
    build(v<<1|1, tm+1, tr);
}

void shift(int v, int tl, int tr)
{
    if(is[v] != -1)
    {
        if(la[v])
            is[v] ^= 1;
        if(is[v])
        {
            seg0[v] = inf;
            seg1[v] = tl;
        }
        else
        {
            seg0[v] = tl;
            seg1[v] = inf;
        }
        if(la[v])
            is[v] ^= 1;

        la[v<<1] ^= la[v];
        is[v<<1] = is[v];
        la[v<<1|1] ^= la[v];
        is[v<<1|1] = is[v];
    }
    else
    {
        if(la[v])
        {
            swap(seg0[v], seg1[v]);
            la[v<<1] ^= 1;
            la[v<<1|1] ^= 1;
        }
    }

    la[v] = 0;
    is[v] = -1;
}

void up(int l, int r, int tp, int v = 1, int tl = 0, int tr = n-1)
{
    if(tl == l && tr == r)
    {
       // cout<< v <<" ";
        if(tp == 1)
        {
            is[v] = 1;
            la[v] = 0;
        }
        if(tp == 2)
        {
            is[v] = 0;
            la[v] = 0;
        }
        if(tp == 3)
        {
            la[v] ^= 1;
        }

        shift(v,tl,tr);
        return;
    }

    shift(v,tl,tr);
    if(l > r) return;

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), tp, v<<1, tl, tm);
    up(max(tm+1,l), r, tp, v<<1|1, tm+1, tr);

    seg0[v] = min(seg0[v<<1], seg0[v<<1|1]);
    seg1[v] = min(seg1[v<<1], seg1[v<<1|1]);
}

int qu(int v = 1, int tl = 0, int tr = n-1)
{
   // cout<<"\n\n";
    for(int i = 1; i <= 13; i++)
    {
   //     cout<< is[i] <<" "<< la[i] <<" "<< seg0[i] <<" "<< seg1[i] <<"\n";
    }

   // cout<<"\n";

    shift(v,tl,tr);
    return seg0[v];
}

set<ll> mp;
vector<ll> a;

void add(ll x)
{
    if(!mp.count(x))
    {
        a.push_back(x);
        mp.insert(x);
    }
}

int main()
{
    int q; cin>> q;
    vector<pair<int,pair<ll,ll>>> que;
    mp.insert(0);
    for(int i = 1; i <= q; i++)
    {
        int tp; ll l, r; cin>> tp >> l >> r;
        que.push_back({tp,{l,r}});

        add(l-1); add(l); add(l+1);
        add(r-1); add(r); add(r+1);
    }

    n = a.size();
    sort(a.begin(), a.end());

  //  cout<<"\n";
  //  for(int i = 0; i < n; i++)
  //      cout<< a[i] <<" ";
  //  cout<<"\n\n";

    build();

    for(auto x : que)
    {
        int tp = x.F; ll l = x.S.F, r = x.S.S;
        int L = lower_bound(a.begin(), a.end(), l) - a.begin();
        int R = lower_bound(a.begin(), a.end(), r) - a.begin();
       // cout<< L <<" "<< R <<"\n\n";
        up(L, R, tp);

        int X = qu();
        if(X == inf) X = n-1;

        if(a[0] != 1)
            cout<< 1 <<"\n";
        else
            cout<< a[X] <<"\n";
    }
}


#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second

typedef long long ll;
typedef long double ld;

const int maxn = 6e5+10;
const int mod = 998244353;
const int inf = 1e9;

int n, m;

int la[4*maxn], is[4*maxn];
int seg0[4*maxn], seg1[4*maxn];

void build(int v = 1, int tl = 0, int tr = n-1)
{
    is[v] = -1;
    seg0[v] = tl;
    seg1[v] = inf;

    if(tl == tr) return;

    int tm = (tl + tr) >> 1;
    build(v<<1, tl, tm);
    build(v<<1|1, tm+1, tr);
}

void shift(int v, int tl, int tr)
{
    if(is[v] != -1)
    {
        if(la[v])
            is[v] ^= 1;
        if(is[v])
        {
            seg0[v] = inf;
            seg1[v] = tl;
        }
        else
        {
            seg0[v] = tl;
            seg1[v] = inf;
        }
        if(la[v])
            is[v] ^= 1;

        la[v<<1] ^= la[v];
        is[v<<1] = is[v];
        la[v<<1|1] ^= la[v];
        is[v<<1|1] = is[v];
    }
    else
    {
        if(la[v])
        {
            swap(seg0[v], seg1[v]);
            la[v<<1] ^= 1;
            la[v<<1|1] ^= 1;
        }
    }

    la[v] = 0;
    is[v] = -1;
}

void up(int l, int r, int tp, int v = 1, int tl = 0, int tr = n-1)
{
    if(tl == l && tr == r)
    {
       // cout<< v <<" ";
        if(tp == 1)
        {
            is[v] = 1;
            la[v] = 0;
        }
        if(tp == 2)
        {
            is[v] = 0;
            la[v] = 0;
        }
        if(tp == 3)
        {
            la[v] ^= 1;
        }

        shift(v,tl,tr);
        return;
    }

    shift(v,tl,tr);
    if(l > r) return;

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), tp, v<<1, tl, tm);
    up(max(tm+1,l), r, tp, v<<1|1, tm+1, tr);

    seg0[v] = min(seg0[v<<1], seg0[v<<1|1]);
    seg1[v] = min(seg1[v<<1], seg1[v<<1|1]);
}

int qu(int v = 1, int tl = 0, int tr = n-1)
{
   // cout<<"\n\n";
  //  for(int i = 1; i <= 13; i++)
   // {
   //     cout<< is[i] <<" "<< la[i] <<" "<< seg0[i] <<" "<< seg1[i] <<"\n";
   // }

   // cout<<"\n";

    shift(v,tl,tr);
    return seg0[v];
}

set<ll> mp;
vector<ll> a;

void add(ll x)
{
    if(!mp.count(x))
    {
        a.push_back(x);
        mp.insert(x);
    }
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int q; cin>> q;
    vector<pair<int,pair<ll,ll>>> que;
    mp.insert(0);
    for(int i = 1; i <= q; i++)
    {
        int tp; ll l, r; cin>> tp >> l >> r;
        que.push_back({tp,{l,r}});

        add(l-1); add(l); add(l+1);
        add(r-1); add(r); add(r+1);
    }

    n = a.size();
    sort(a.begin(), a.end());

  //  cout<<"\n";
  //  for(int i = 0; i < n; i++)
  //      cout<< a[i] <<" ";
  //  cout<<"\n\n";

    build();

    for(auto x : que)
    {
        int tp = x.F; ll l = x.S.F, r = x.S.S;
        int L = lower_bound(a.begin(), a.end(), l) - a.begin();
        int R = lower_bound(a.begin(), a.end(), r) - a.begin();
       // cout<< L <<" "<< R <<"\n\n";
        up(L, R, tp);

        int X = qu();
        if(X == inf) X = n-1;

        if(a[0] != 1)
            cout<< 1 <<"\n";
        else
            cout<< a[X] <<"\n";
    }
}


#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second

typedef long long ll;
typedef long double ld;

const int maxn = 6e5+10;
const int mod = 998244353;
const int inf = 1e9;

int n, m;

int la[4*maxn], is[4*maxn];
int seg0[4*maxn], seg1[4*maxn];

void build(int v = 1, int tl = 0, int tr = n-1)
{
    is[v] = -1;
    seg0[v] = tl;
    seg1[v] = inf;

    if(tl == tr) return;

    int tm = (tl + tr) >> 1;
    build(v<<1, tl, tm);
    build(v<<1|1, tm+1, tr);
}

void shift(int v, int tl, int tr)
{
    if(is[v] != -1)
    {
        if(la[v])
            is[v] ^= 1;
        if(is[v])
        {
            seg0[v] = inf;
            seg1[v] = tl;
        }
        else
        {
            seg0[v] = tl;
            seg1[v] = inf;
        }
        if(la[v])
            is[v] ^= 1;

        la[v<<1] = la[v];
        is[v<<1] = is[v];
        la[v<<1|1] = la[v];
        is[v<<1|1] = is[v];
    }
    else
    {
        if(la[v])
        {
            swap(seg0[v], seg1[v]);
            la[v<<1] ^= 1;
            la[v<<1|1] ^= 1;
        }
    }

    la[v] = 0;
    is[v] = -1;
}

void up(int l, int r, int tp, int v = 1, int tl = 0, int tr = n-1)
{
    if(tl == l && tr == r)
    {
        if(tp == 1)
        {
            is[v] = 1;
            la[v] = 0;
        }
        if(tp == 2)
        {
            is[v] = 0;
            la[v] = 0;
        }
        if(tp == 3)
        {
            la[v] ^= 1;
        }

        shift(v,tl,tr);
        return;
    }

    shift(v,tl,tr);
    if(l > r) return;

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), tp, v<<1, tl, tm);
    up(max(tm+1,l), r, tp, v<<1|1, tm+1, tr);

    seg0[v] = min(seg0[v<<1], seg0[v<<1|1]);
    seg1[v] = min(seg1[v<<1], seg1[v<<1|1]);
}

int qu(int v = 1, int tl = 0, int tr = n-1)
{
    shift(v,tl,tr);
    return seg0[v];
}

set<ll> mp;
vector<ll> a;

void add(ll x)
{
    if(!mp.count(x))
    {
        a.push_back(x);
        mp.insert(x);
    }
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int q; cin>> q;
    vector<pair<int,pair<ll,ll>>> que;
    mp.insert(0);
    for(int i = 1; i <= q; i++)
    {
        int tp; ll l, r; cin>> tp >> l >> r;
        que.push_back({tp,{l,r}});

        add(l-1); add(l); add(l+1);
        add(r-1); add(r); add(r+1);
    }

    n = a.size();
    sort(a.begin(), a.end());

    build();

    for(auto x : que)
    {
        int tp = x.F; ll l = x.S.F, r = x.S.S;
        int L = lower_bound(a.begin(), a.end(), l) - a.begin();
        int R = lower_bound(a.begin(), a.end(), r) - a.begin();
        up(L, R, tp);

        int X = qu();
        if(X == inf) X = n-1;

        if(a[0] != 1)
            cout<< 1 <<"\n";
        else
            cout<< a[X] <<"\n";
    }
}


#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second

typedef long long ll;
typedef long double ld;

const int maxn = 6e5+10;
const int mod = 998244353;
const int inf = 1e9;

int n, m;

int la[4*maxn], is[4*maxn];
int seg0[4*maxn], seg1[4*maxn];

void build(int v = 1, int tl = 0, int tr = n-1)
{
    is[v] = -1;
    seg0[v] = tl;
    seg1[v] = inf;

    if(tl == tr) return;

    int tm = (tl + tr) >> 1;
    build(v<<1, tl, tm);
    build(v<<1|1, tm+1, tr);
}

void shift(int v, int tl, int tr)
{
    if(is[v] != -1)
    {
        if(la[v])
            is[v] ^= 1;
        if(is[v])
        {
            seg0[v] = inf;
            seg1[v] = tl;
        }
        else
        {
            seg0[v] = tl;
            seg1[v] = inf;
        }
        if(la[v])
            is[v] ^= 1;

        if((v<<1) < 4*maxn)
        {
            la[v<<1] = la[v];
            is[v<<1] = is[v];
            la[v<<1|1] = la[v];
            is[v<<1|1] = is[v];
        }
    }
    else
    {
        if(la[v])
        {
            swap(seg0[v], seg1[v]);
            if((v<<1) < 4*maxn)
            {
                la[v<<1] ^= 1;
                la[v<<1|1] ^= 1;
            }
        }
    }

    la[v] = 0;
    is[v] = -1;
}

void up(int l, int r, int tp, int v = 1, int tl = 0, int tr = n-1)
{
    if(tl == l && tr == r)
    {
        if(tp == 1)
        {
            is[v] = 1;
            la[v] = 0;
        }
        if(tp == 2)
        {
            is[v] = 0;
            la[v] = 0;
        }
        if(tp == 3)
        {
            la[v] ^= 1;
        }

        shift(v,tl,tr);
        return;
    }

    shift(v,tl,tr);
    if(l > r) return;

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), tp, v<<1, tl, tm);
    up(max(tm+1,l), r, tp, v<<1|1, tm+1, tr);

    seg0[v] = min(seg0[v<<1], seg0[v<<1|1]);
    seg1[v] = min(seg1[v<<1], seg1[v<<1|1]);
}

int qu(int v = 1, int tl = 0, int tr = n-1)
{
    shift(v,tl,tr);
    return seg0[v];
}

set<ll> mp;
vector<ll> a;

void add(ll x)
{
    if(!mp.count(x))
    {
        a.push_back(x);
        mp.insert(x);
    }
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int q; cin>> q;
    vector<pair<int,pair<ll,ll>>> que;
    mp.insert(0);
    for(int i = 1; i <= q; i++)
    {
        int tp; ll l, r; cin>> tp >> l >> r;
        que.push_back({tp,{l,r}});

        add(l-1); add(l); add(l+1);
        add(r-1); add(r); add(r+1);
    }

    n = a.size();
    sort(a.begin(), a.end());

    build();

    for(auto x : que)
    {
        int tp = x.F; ll l = x.S.F, r = x.S.S;
        int L = lower_bound(a.begin(), a.end(), l) - a.begin();
        int R = lower_bound(a.begin(), a.end(), r) - a.begin();
        up(L, R, tp);

        int X = qu();
        if(X == inf) X = n-1;

        if(a[0] != 1)
            cout<< 1 <<"\n";
        else
            cout<< a[X] <<"\n";
    }
}


/*input
4
1 1 3
3 5 6
2 4 4
3 1 6

*/

//If you want something you never had, you must do something you've never done.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define inf 100000000000001
#define F first
#define S second
#define dbg(x) cout << #x << " = " << x << '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define N 200005

vector<ll> v;
ll n;

ll lo[4*N+1],hi[4*N+1],len[4*N+1],cnt[4*N+1],se[4*N+1],flip[4*N+1];

void build(ll i,ll a,ll b)
{
    lo[i]=a;
    hi[i]=b;
    if(a==b)
    {
        len[i]=1;
        cnt[i]=0;
        return;
    }
    ll m=(a+b)>>1;
    build(2*i,a,m);
    build(2*i+1,m+1,b);
    len[i]=len[2*i]+len[2*i+1];
}

void prop(ll i)
{
    if(se[i]!=-1)
    {
        cnt[i]=len[i]*se[i];
        se[2*i]=se[2*i+1]=se[i];
        flip[2*i]=flip[2*i+1]=0;
        se[i]=-1;
    }
    if(flip[i])
    {
        cnt[i]=len[i]-cnt[i];
        flip[2*i]=1-flip[2*i];
        flip[2*i+1]=1-flip[2*i+1];
        flip[i]=0;
    }
}

void change(ll i,ll a,ll b,ll val)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        se[i]=val;
        prop(i);
        return;
    }
    prop(i);
    change(2*i,a,b,val);
    change(2*i+1,a,b,val);
    cnt[i]=cnt[2*i]+cnt[2*i+1];
}

void invert(ll i,ll a,ll b)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        flip[i]=1-flip[i];
        prop(i);
        return;
    }
    prop(i);
    invert(2*i,a,b);
    invert(2*i+1,a,b);
    cnt[i]=cnt[2*i]+cnt[2*i+1];
}

ll query(ll i)
{
    prop(i);
    if(cnt[i]==len[i])
        return -1;
    if(lo[i]==hi[i])
        return v[lo[i]];
    ll res=query(2*i);
    if(res==-1)
        res=query(2*i+1);
    cnt[i]=cnt[2*i]+cnt[2*i+1];
    return res;
}

void solve()
{
    cin>>n;
    ll t[n],a[n],b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>t[i]>>a[i]>>b[i];
        v.push_back(a[i]);
        v.push_back(b[i]+1);
    }
    v.push_back(1);
    sort(all(v));
    auto ip=unique(all(v));
    v.resize(distance(v.begin(),ip));
    ll m=v.size();
    build(1,0,m-1);
    for(ll i=0;i<n;i++)
    {
        ll x=lower_bound(all(v),a[i])-v.begin();
        ll y=lower_bound(all(v),b[i]+1)-v.begin()-1;
        if(t[i]==1)
            change(1,x,y,1);
        else if(t[i]==2)
            change(1,x,y,0);
        else
            invert(1,x,y);
        cout<<query(1)<<endl;
    }
}

int main()
{
    off;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}


/*input
20
3 20 37
1 1 32
1 22 70
3 40 61
3 50 50
3 52 59
1 65 66
3 59 73
3 72 76
2 73 75
1 72 75
2 74 75
1 65 78
2 74 80
2 76 79
3 72 84
2 84 87
3 87 87
1 81 83
2 81 85

*/

//If you want something you never had, you must do something you've never done.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define inf 100000000000001
#define F first
#define S second
#define dbg(x) cout << #x << " = " << x << '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define N 200005

vector<ll> v;
ll n;

ll lo[4*N+1],hi[4*N+1],len[4*N+1],cnt[4*N+1],se[4*N+1],flip[4*N+1];

void update(ll i)
{
    ll le,ri;
    if(se[2*i]==-1)
        le=(flip[2*i])?(len[2*i]-cnt[2*i]):cnt[2*i];
    else
        le=se[2*i]*len[2*i];
    if(se[2*i+1]==-1)
        ri=(flip[2*i+1])?(len[2*i+1]-cnt[2*i+1]):cnt[2*i+1];
    else
        ri=se[2*i+1]*len[2*i+1];
    cnt[i]=le+ri;
}

void build(ll i,ll a,ll b)
{
    lo[i]=a;
    hi[i]=b;
    if(a==b)
    {
        len[i]=1;
        cnt[i]=0;
        return;
    }
    ll m=(a+b)>>1;
    build(2*i,a,m);
    build(2*i+1,m+1,b);
    len[i]=len[2*i]+len[2*i+1];
}

void prop(ll i)
{
    if(se[i]!=-1)
    {
        se[2*i]=se[2*i+1]=se[i];
        flip[2*i]=flip[2*i+1]=0;
        se[i]=-1;
    }
    if(flip[i])
    {
        if(se[2*i]==-1)
            flip[2*i]=1-flip[2*i];
        else
            se[2*i]=1-se[2*i];
        if(se[2*i+1]==-1)
            flip[2*i+1]=1-flip[2*i+1];
        else
            se[2*i+1]=1-se[2*i+1];
        flip[i]=0;
    }
}

void change(ll i,ll a,ll b,ll val)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        se[i]=val;
        flip[i]=0;
        return;
    }
    prop(i);
    change(2*i,a,b,val);
    change(2*i+1,a,b,val);
    update(i);
}

void invert(ll i,ll a,ll b)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        if(se[i]!=-1)
            se[i]=1-se[i];
        else
            flip[i]=1-flip[i];
        return;
    }
    prop(i);
    invert(2*i,a,b);
    invert(2*i+1,a,b);
    update(i);
}

ll query(ll i)
{
    ll ans;
    if(se[i]==-1)
        ans=(flip[i])?len[i]-cnt[i]:cnt[i];
    else
        ans=se[i]*len[i];
    if(ans==len[i])
        return -1;
    if(lo[i]==hi[i])
        return v[lo[i]];
    prop(i);
    ll res=query(2*i);
    if(res==-1)
        res=query(2*i+1);
    update(i);
    return res;
}

void solve()
{
    cin>>n;
    ll t[n],a[n],b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>t[i]>>a[i]>>b[i];
        v.push_back(a[i]);
        v.push_back(b[i]+1);
    }
    v.push_back(1);
    sort(all(v));
    auto ip=unique(all(v));
    v.resize(distance(v.begin(),ip));
    ll m=v.size();
    memset(se,-1,sizeof(se));
    build(1,0,m-1);
    for(ll i=0;i<n;i++)
    {
        ll x=lower_bound(all(v),a[i])-v.begin();
        ll y=lower_bound(all(v),b[i]+1)-v.begin()-1;
        if(t[i]==1)
            change(1,x,y,1);
        else if(t[i]==2)
            change(1,x,y,0);
        else
            invert(1,x,y);
        cout<<query(1)<<endl;
    }
}

int main()
{
    off;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}


/*input
20
3 20 37
1 1 32
1 22 70
3 40 61
3 50 50
3 52 59
1 65 66
3 59 73
3 72 76
2 73 75
1 72 75
2 74 75
1 65 78
2 74 80
2 76 79
3 72 84
2 84 87
3 87 87
1 81 83
2 81 85

*/

//If you want something you never had, you must do something you've never done.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define inf 100000000000001
#define F first
#define S second
#define dbg(x) cout << #x << " = " << x << '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define N 200005

vector<ll> v;
ll n;

ll lo[4*N+1],hi[4*N+1],len[4*N+1],cnt[4*N+1],se[4*N+1],flip[4*N+1];

void update(ll i)
{
    ll le,ri;
    if(se[2*i]==-1)
        le=(flip[2*i])?(len[2*i]-cnt[2*i]):cnt[2*i];
    else
        le=se[2*i]*len[2*i];
    if(se[2*i+1]==-1)
        ri=(flip[2*i+1])?(len[2*i+1]-cnt[2*i+1]):cnt[2*i+1];
    else
        ri=se[2*i+1]*len[2*i+1];
    cnt[i]=le+ri;
}

void build(ll i,ll a,ll b)
{
    lo[i]=a;
    hi[i]=b;
    if(a==b)
    {
        len[i]=1;
        cnt[i]=0;
        return;
    }
    ll m=(a+b)>>1;
    build(2*i,a,m);
    build(2*i+1,m+1,b);
    len[i]=len[2*i]+len[2*i+1];
}

void prop(ll i)
{
    if(se[i]!=-1)
    {
        se[2*i]=se[2*i+1]=se[i];
        flip[2*i]=flip[2*i+1]=0;
        se[i]=-1;
    }
    if(flip[i])
    {
        if(se[2*i]==-1)
            flip[2*i]=1-flip[2*i];
        else
            se[2*i]=1-se[2*i];
        if(se[2*i+1]==-1)
            flip[2*i+1]=1-flip[2*i+1];
        else
            se[2*i+1]=1-se[2*i+1];
        flip[i]=0;
    }
}

void change(ll i,ll a,ll b,ll val)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        se[i]=val;
        flip[i]=0;
        return;
    }
    prop(i);
    change(2*i,a,b,val);
    change(2*i+1,a,b,val);
    update(i);
}

void invert(ll i,ll a,ll b)
{
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        if(se[i]!=-1)
            se[i]=1-se[i];
        else
            flip[i]=1-flip[i];
        return;
    }
    prop(i);
    invert(2*i,a,b);
    invert(2*i+1,a,b);
    update(i);
}

ll query(ll i)
{
    ll ans;
    if(se[i]==-1)
        ans=(flip[i])?len[i]-cnt[i]:cnt[i];
    else
        ans=se[i]*len[i];
    if(ans==len[i])
        return -1;
    if(lo[i]==hi[i])
    {
        if(ans==0)
            return v[lo[i]];
        else
            return -1;
    }
    prop(i);
    ll res=query(2*i);
    if(res==-1)
        res=query(2*i+1);
    update(i);
    return res;
}

void solve()
{
    cin>>n;
    ll t[n],a[n],b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>t[i]>>a[i]>>b[i];
        v.push_back(a[i]);
        v.push_back(b[i]+1);
    }
    v.push_back(1);
    sort(all(v));
    auto ip=unique(all(v));
    v.resize(distance(v.begin(),ip));
    ll m=v.size();
    memset(se,-1,sizeof(se));
    build(1,0,m-1);
    for(ll i=0;i<n;i++)
    {
        ll x=lower_bound(all(v),a[i])-v.begin();
        ll y=lower_bound(all(v),b[i]+1)-v.begin()-1;
        if(t[i]==1)
            change(1,x,y,1);
        else if(t[i]==2)
            change(1,x,y,0);
        else
            invert(1,x,y);
        cout<<query(1)<<endl;
    }
}

int main()
{
    off;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}


/*input
20
3 20 37
1 1 32
1 22 70
3 40 61
3 50 50
3 52 59
1 65 66
3 59 73
3 72 76
2 73 75
1 72 75
2 74 75
1 65 78
2 74 80
2 76 79
3 72 84
2 84 87
3 87 87
1 81 83
2 81 85
*/

//If you want something you never had, you must do something you've never done.

//code author: iamxlr8

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(c) c.begin(),c.end()
#define mod 1000000007
#define inf 100000000000001
#define F first
#define S second
#define dbg(x) cout << #x << " = " << x << '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define N 200005

vector<ll> v;
ll n;

ll lo[4*N+1],hi[4*N+1],len[4*N+1],cnt[4*N+1],se[4*N+1],flip[4*N+1];

void build(ll i,ll a,ll b)
{
    lo[i]=a;
    hi[i]=b;
    if(a==b)
    {
        len[i]=1;
        cnt[i]=0;
        return;
    }
    ll m=(a+b)>>1;
    build(2*i,a,m);
    build(2*i+1,m+1,b);
    len[i]=len[2*i]+len[2*i+1];
}

void prop(ll i)
{
    if(se[i]!=-1)
    {
        cnt[i]=len[i]*se[i];
        se[2*i]=se[2*i+1]=se[i];
        flip[2*i]=flip[2*i+1]=0;
        se[i]=-1;
    }
    if(flip[i])
    {
        cnt[i]=len[i]-cnt[i];
        flip[2*i]=1-flip[2*i];
        flip[2*i+1]=1-flip[2*i+1];
        flip[i]=0;
    }
}

void change(ll i,ll a,ll b,ll val)
{
    prop(i);
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        se[i]=val;
        prop(i);
        return;
    }
    change(2*i,a,b,val);
    change(2*i+1,a,b,val);
    cnt[i]=cnt[2*i]+cnt[2*i+1];
}

void invert(ll i,ll a,ll b)
{
    prop(i);
    if(b<lo[i]||hi[i]<a)
        return;
    if(a<=lo[i]&&hi[i]<=b)
    {
        flip[i]=1-flip[i];
        prop(i);
        return;
    }
    invert(2*i,a,b);
    invert(2*i+1,a,b);
    cnt[i]=cnt[2*i]+cnt[2*i+1];
}

ll query(ll i)
{
    prop(i);
    if(cnt[i]==len[i])
        return -1;
    if(lo[i]==hi[i])
        return v[lo[i]];
    ll res=query(2*i);
    if(res==-1)
        res=query(2*i+1);
    // cnt[i]=cnt[2*i]+cnt[2*i+1];
    return res;
}

void solve()
{
    cin>>n;
    ll t[n],a[n],b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>t[i]>>a[i]>>b[i];
        v.push_back(a[i]);
        v.push_back(b[i]+1);
    }
    v.push_back(1);
    sort(all(v));
    auto ip=unique(all(v));
    v.resize(distance(v.begin(),ip));
    ll m=v.size();
    build(1,0,m-1);
    for(ll i=0;i<n;i++)
    {
        ll x=lower_bound(all(v),a[i])-v.begin();
        ll y=lower_bound(all(v),b[i]+1)-v.begin()-1;
        if(t[i]==1)
            change(1,x,y,1);
        else if(t[i]==2)
            change(1,x,y,0);
        else
            invert(1,x,y);
        cout<<query(1)<<endl;
    }
}

int main()
{
    off;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll tests=1;
    // cin>>tests;
    while(tests--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 3e5 + 10;

long long n, l[100100], r[100100];
int t[100100], cnt;

struct nod {
	nod * l, * r;

	int val = 0;
	char lazy = 0;

	nod() {
		l = r = 0;
		cnt++;
	}
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	dbg(v);
	// dbg(v);
	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));
	dbg(v);
	// dbg_ok;
	// dbg(m[1]);

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		long long x = v[i];
		m[x] = i + 1;
		assert(m[x] < N);
		assert(0 < m[x]);
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		assert(m[l[i]] != 0);
		assert(m[r[i]] != 0);
		// dbg(l[i], r[i], t[i]);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		// dbg(m[l[i]], m[r[i]], t[i]);
		int pos = query(root, 1, N) - 1;
		// dbg(pos);
		assert(pos < v.size());
		cout << v[pos] << '\n';
	}
	dbg(cnt);

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 5e5;

long long n, l[100100], r[100100], t[100100];

struct nod {
	nod * l, * r;

	long long val = 0;
	char lazy = 0;
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	sort(v.begin(), v.end());
	// dbg(v);
	m[1] = 1;
	m[2] = 2;
	// dbg_ok;
	// dbg(m[1]);

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		int x = v[i];
		m[x] = i + 1;
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		// dbg(l[i], r[i], t[i]);
		update(root, 1, N, l[i], r[i], t[i]);
		cout << v[query(root, 1, N) - 1] << '\n';
	}

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 3e5 + 10;

long long n, l[100100], r[100100];
int t[100100];

struct nod {
	nod * l, * r;

	int val = 0;
	char lazy = 0;
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));
	// dbg(v);
	m[1] = 1;
	m[2] = 2;
	// dbg_ok;
	// dbg(m[1]);

	v.clear();

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		int x = v[i];
		m[x] = i + 1;
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		// dbg(l[i], r[i], t[i]);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		// dbg(m[l[i]], m[r[i]], t[i]);
		int pos = query(root, 1, N) - 1;
		// dbg(pos);
		cout << v[pos] << '\n';
	}

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 3e5 + 10;

long long n, l[100100], r[100100];
int t[100100], cnt;

struct nod {
	nod * l, * r;

	int val = 0;
	char lazy = 0;

	nod() {
		l = r = 0;
		cnt++;
	}
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	// dbg(v);
	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));

	// dbg_ok;
	// dbg(m[1]);

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		long long x = v[i];
		m[x] = i + 1;
		assert(m[x] < N);
		assert(0 < m[x]);
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		assert(m[l[i]] != 0);
		assert(m[r[i]] != 0);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		int pos = query(root, 1, N) - 1;
		assert(pos >= 0);
		assert(pos < v.size());
		cout << v[pos] << '\n';
	}
	dbg(cnt);

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 3e5 + 10;

long long n, l[100100], r[100100], ret[300100];
long long t[100100], cnt;

struct nod {
	nod * l, * r;

	long long val = 0;
	char lazy = 0;

	nod() {
		l = r = 0;
		cnt++;
	}
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	sort(v.begin(), v.end());

	int nr = 0;
	for(long long i = 0; i < v.size(); i++) {

		if(m[v[i]]) continue;
		ret[nr] = v[i];
		m[v[i]] = ++nr;
		// dbg(m[x]);
		// dbg_ok;
	}

	for(long long i = 1; i <= n; i++) {
		assert(m[l[i]] != 0);
		assert(m[r[i]] != 0);
		assert(cnt < 4 * N);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		long long pos = query(root, 1, N) - 1;
		assert(pos >= 0);
		cout << ret[pos] << '\n';
	}
	dbg(cnt);

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 3e5 + 10;

long long n, l[100100], r[100100];
int t[100100];

struct nod {
	nod * l, * r;

	int val = 0;
	char lazy = 0;
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));
	// dbg(v);
	m[1] = 1;
	m[2] = 2;
	// dbg_ok;
	// dbg(m[1]);

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		int x = v[i];
		m[x] = i + 1;
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		// dbg(l[i], r[i], t[i]);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		// dbg(m[l[i]], m[r[i]], t[i]);
		int pos = query(root, 1, N) - 1;
		// dbg(pos);
		cout << v[pos] << '\n';
	}

}


#pragma pack(1)
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) //cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

const long long N = 1e18 + 10;

long long n, l, r, t;

struct nod {
	nod * l, * r;

	long long val = 0;
	char lazy = 0;
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(!node->l) node->l = new nod();
		if(!node->r) node->r = new nod();

		if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
		else node->l->lazy = 3 - node->l->lazy;

		if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
		else node->r->lazy = 3 - node->r->lazy;

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	dbg(node, l, r);
	push(node, l, r);

	if((l == 3 || l == 1)&& r == 4) {
		dbg(l, r, node->val, node->lazy, val);
	}

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);
	dbg(l,r, node->val, value(node->l, l, mid) , value(node->r, mid + 1, r));
}

long long query(nod * node, long long l, long long r) {
	dbg(node, l, r);
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;
	dbg(value(node->l, l, mid));
	if(node->l) {
		dbg(node->l->val, node->l->lazy);
	}
	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t >> l >> r;
		if(t != 3) t = 3 - t;;
		update(root, 1, N, l, r, t);
		cout << query(root, 1, N) << '\n';
	}

}


#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!" << endl

const long long N = 5e5;

long long n, l[100100], r[100100], t[100100];

struct nod {
	nod * l, * r;

	long long val = 0;
	char lazy = 0;
};

long long value(nod * node, long long l, long long r) {
	if(node == 0) return 0;
	if(node->lazy == 0)
		return node->val;
	if(node->lazy < 3)
		return (node->lazy - 1) * (r - l + 1);
	return (r - l + 1) - node->val;
}

void push(nod * node, long long l, long long r) {
	if(node->lazy) {
		if(l != r) {
			if(!node->l) node->l = new nod();
			if(!node->r) node->r = new nod();

			if(!node->l->lazy || node->lazy != 3) node->l->lazy = node->lazy;
			else node->l->lazy = 3 - node->l->lazy;

			if(!node->r->lazy || node->lazy != 3) node->r->lazy = node->lazy;
			else node->r->lazy = 3 - node->r->lazy;
		}

		if(node->lazy != 3) node->val = (node->lazy - 1) * (r - l  + 1);
		else node->val = (r - l + 1) - node->val;
		node->lazy = 0;
	}
}

void update(nod * node, long long l, long long r, long long x, long long y, long long val) {
	push(node, l, r);

	if(x <= l && r <= y)
		return void(node->lazy = val);

	long long mid = (l + r) / 2;
	if(x <= mid) {
		if(!node->l) node->l = new nod();
		update(node->l, l, mid, x, y, val);
	}
	if(y > mid) {
		if(!node->r) node->r = new nod();
		update(node->r, mid + 1, r, x, y, val);
	}

	node->val = value(node->l, l, mid) + value(node->r, mid + 1, r);

}
vector <long long> v;
map <long long, long long> m;

long long query(nod * node, long long l, long long r) {
	push(node, l, r);
	if(l == r) return l;

	long long mid = (l + r) / 2;

	if(value(node->l, l, mid) < (mid - l + 1)) {
		if(!node->l) return l;
		return query(node->l, l, mid);
	}
	if(!node->r) return mid + 1;
	return query(node->r, mid + 1, r);
}

int main() {
	ios_base::sync_with_stdio(false);
	nod * root =new nod();
	// update(root, 1, N, 3, 4, 2);
	// update(root, 1, N, 1, 6, 3);
	// cout << query(root, 1, N);

	cin >> n;
	for(long long i = 1; i <= n; i++) {
		cin >> t[i] >> l[i] >> r[i];
		if(t[i] != 3) t[i] = 3 - t[i];
		v.push_back(l[i]);
		v.push_back(r[i]);
		v.push_back(r[i] + 1);
	}

	sort(v.begin(), v.end());
	v.resize(distance(v.begin(), unique(v.begin(), v.end())));
	// dbg(v);
	m[1] = 1;
	m[2] = 2;
	// dbg_ok;
	// dbg(m[1]);

	for(long long i = 0; i < v.size(); i++) {
		// dbg(v[i], i, m[v[i]]);
		int x = v[i];
		m[x] = i + 1;
		// dbg(m[x]);
		// dbg_ok;
	}

	for(int i = 1; i <= n; i++) {
		// dbg(l[i], r[i], t[i]);
		update(root, 1, N, m[l[i]], m[r[i]], t[i]);
		// dbg(m[l[i]], m[r[i]], t[i]);
		int pos = query(root, 1, N) - 1;
		// dbg(pos);
		cout << v[pos] << '\n';
	}

}