#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int tree[N + 100], lazy[N + 100], toggle[N + 100];
vector<long long> ele;
vector<pair<pair<long long, long long>, int> > Q;
int now = 0;
void push(int v, int tl, int tr) {
  int tm = (tl + tr) / 2;
  if (lazy[v] == -1) {
    if (toggle[v]) {
      tree[v * 2] = tm - tl + 1 - tree[v * 2];
      tree[v * 2 + 1] = tr - tm - tree[v * 2 + 1];
      toggle[v * 2] ^= 1;
      toggle[v * 2 + 1] ^= 1;
    }
  } else {
    lazy[v] ^= toggle[v];
    if (lazy[v]) {
      tree[v * 2] = tm - tl + 1;
      tree[v * 2 + 1] = tr - tm;
    } else {
      tree[v * 2] = tree[v * 2 + 1] = 0;
    }
    lazy[v * 2] = lazy[v * 2 + 1] = lazy[v];
    toggle[v * 2] = toggle[v * 2 + 1] = 0;
  }
  toggle[v] = 0;
  lazy[v] = -1;
}
void update(int v, int tl, int tr, int l, int r, int val) {
  if (l > r) return;
  if (tl == l && tr == r) {
    if (val == 1) {
      tree[v] = tr - tl + 1;
      lazy[v] = 1;
      toggle[v] = 0;
    } else if (val == 2) {
      tree[v] = 0;
      lazy[v] = 0;
      toggle[v] = 0;
    } else {
      tree[v] = tr - tl + 1 - tree[v];
      toggle[v] ^= 1;
    }
    return;
  }
  push(v, tl, tr);
  int tm = (tl + tr) / 2;
  update(v * 2, tl, tm, l, min(r, tm), val);
  update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
  tree[v] = tree[v * 2] + tree[v * 2 + 1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long l, r;
    int k;
    cin >> k >> l >> r;
    ele.push_back(l);
    ele.push_back(r + 1);
    Q.push_back(make_pair(make_pair(l, r), k));
  }
  ele.push_back(1);
  ele.push_back(1e18 + 1);
  sort(ele.begin(), ele.end());
  n = unique(ele.begin(), ele.end()) - ele.begin();
  for (auto it : Q) {
    now++;
    int l =
        lower_bound(ele.begin(), ele.begin() + n, it.first.first) - ele.begin();
    int r = lower_bound(ele.begin(), ele.begin() + n, it.first.second + 1) -
            ele.begin();
    update(1, 1, n, l + 1, r, it.second);
    int v = 1, tl = 1, tr = n;
    while (1) {
      if (tl == tr) {
        cout << ele[tl - 1] << "\n";
        break;
      }
      push(v, tl, tr);
      int tm = (tl + tr) / 2;
      if (tree[v * 2] < tm - tl + 1) {
        v = v * 2;
        tr = tm;
      } else {
        v = v * 2 + 1;
        tl = tm + 1;
      }
    }
  }
}
