#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
vector<long long> v;
int n, sum[maxn * 4], lazy[maxn * 4];
map<long long, bool> mp;
pair<int, pair<long long, long long> > q[maxn];
void put(int s, int e, int id, int x) {
  if (x == 3) {
    if (lazy[id] == 1) {
      lazy[id] = 2;
      sum[id] = 0;
    } else if (lazy[id] == 2) {
      lazy[id] = 1;
      sum[id] = e - s;
    } else if (lazy[id] == 3) {
      lazy[id] = 0;
      sum[id] = (e - s) - sum[id];
    } else {
      lazy[id] = 3;
      sum[id] = ((e - s) - sum[id]);
    }
  } else {
    if (x == 2) {
      lazy[id] = 2;
      sum[id] = 0;
    } else if (x == 1) {
      lazy[id] = 1;
      sum[id] = e - s;
    }
  }
}
void shift(int s, int e, int id) {
  int mid = (s + e) / 2;
  put(s, mid, id << 1, lazy[id]);
  put(mid, e, id << 1 | 1, lazy[id]);
  lazy[id] = 0;
}
void update(int l, int r, int x, int id = 1, int s = 0, int e = v.size()) {
  if (e <= l || r <= s) return;
  if (l <= s && e <= r) {
    put(s, e, id, x);
    return;
  }
  shift(s, e, id);
  int mid = (s + e) / 2;
  update(l, r, x, id << 1, s, mid);
  update(l, r, x, id << 1 | 1, mid, e);
  sum[id] = sum[id << 1] + sum[id << 1 | 1];
}
int get(int id = 1, int s = 0, int e = v.size()) {
  if (sum[id] == e - s) {
    return -1;
  }
  if (s + 1 == e) {
    return s;
  }
  shift(s, e, id);
  int mid = (s + e) / 2;
  int ans = get(id << 1, s, mid);
  if (ans == -1)
    return get(id << 1 | 1, mid, e);
  else
    return ans;
}
void get2(int id = 1, int s = 0, int e = v.size()) {
  if (s + 1 == e) {
    return;
  }
  shift(s, e, id);
  int mid = (s + e) / 2;
  get2(id << 1, s, mid);
  get2(id << 1 | 1, mid, e);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  mp[1] = 1;
  v.push_back(1);
  mp[1e18 + 1] = 1;
  v.push_back(1e18 + 1);
  long long l1, r1;
  for (int a, i = 0; i < n; i++) {
    cin >> a >> l1 >> r1;
    r1++;
    if (mp[l1] == 0) {
      v.push_back(l1);
      mp[l1] = 1;
    }
    if (mp[r1] == 0) {
      v.push_back(r1);
      mp[r1] = 1;
    }
    q[i] = make_pair(a, make_pair(l1, r1));
  }
  sort(v.begin(), v.end());
  pair<long long, long long> p;
  for (int i = 0; i < n; i++) {
    p = q[i].second;
    update(lower_bound(v.begin(), v.end(), p.first) - v.begin(),
           lower_bound(v.begin(), v.end(), p.second) - v.begin(), q[i].first);
    cout << v[get()] << endl;
  }
  return 0;
}
