#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10, inf = 1e9, N = 3e5 + 1;
int seg[4 * MAXN], lazy[4 * MAXN], id[4 * MAXN], r_ind[MAXN];
vector<pair<pair<int, int>, int> > l[N], r[N], v[N];
vector<int> r_sorted;
void build(int v, int s, int e) {
  if (e - s < 2) {
    seg[v] = -inf;
    id[v] = s;
    return;
  }
  int mid = (s + e) / 2;
  build(2 * v, s, mid);
  build(2 * v + 1, mid, e);
  seg[v] = seg[2 * v];
  id[v] = id[2 * v];
  return;
}
void shift(int v) {
  lazy[2 * v] += lazy[v];
  seg[2 * v] += lazy[v];
  lazy[2 * v + 1] += lazy[v];
  seg[2 * v + 1] += lazy[v];
  lazy[v] = 0;
}
void upd(int v, int l, int r, int val, int s, int e) {
  if (l <= s and e <= r) {
    seg[v] += val;
    lazy[v] += val;
    return;
  }
  if (e <= l or r <= s) return;
  shift(v);
  int mid = (s + e) / 2;
  upd(2 * v, l, r, val, s, mid);
  upd(2 * v + 1, l, r, val, mid, e);
  seg[v] = max(seg[2 * v], seg[2 * v + 1]);
  id[v] = (seg[2 * v] > seg[2 * v + 1] ? id[2 * v] : id[2 * v + 1]);
  return;
}
int main() {
  int n;
  cin >> n;
  build(1, 0, n);
  for (int i = 0; i < n; i++) {
    int l2, v2, r2;
    cin >> l2 >> v2 >> r2;
    l[l2].push_back({{v2, r2}, i});
    v[v2].push_back({{l2, r2}, i});
    r[r2].push_back({{l2, v2}, i});
    r_sorted.push_back(r2);
  }
  int index = 0, mx = -1, id_l, id_r;
  for (int i = 0; i < 3e5 + 1; i++)
    for (auto u : r[i]) r_ind[u.second] = index++;
  sort(r_sorted.begin(), r_sorted.end());
  for (int i = 0; i < 3e5 + 1; i++) {
    for (auto u : l[i]) {
      upd(1, r_ind[u.second], r_ind[u.second] + 1, inf, 0, n);
      int ind = lower_bound(r_sorted.begin(), r_sorted.end(), u.first.first) -
                r_sorted.begin();
      upd(1, ind, r_ind[u.second] + 1, +1, 0, n);
    }
    if (i > 0) {
      for (auto u : v[i - 1]) {
        int ind = lower_bound(r_sorted.begin(), r_sorted.end(), i - 1) -
                  r_sorted.begin();
        upd(1, ind, r_ind[u.second] + 1, -1, 0, n);
      }
      for (auto u : r[i - 1])
        upd(1, r_ind[u.second], r_ind[u.second] + 1, -inf, 0, n);
    }
    if (seg[1] > mx) {
      mx = seg[1];
      id_l = i;
      id_r = r_sorted[id[1]];
    }
  }
  cout << mx << endl;
  for (int i = id_l; i <= id_r; i++)
    for (auto u : v[i])
      if (u.first.first <= id_l and u.first.second >= id_r)
        cout << u.second + 1 << ' ';
  return 0;
}
