#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 20, Mod = 1e9 + 7, lg = 20;
long long n, L[maxn], R[maxn], V[maxn], seg[4 * maxn], lazy[4 * maxn], ans,
    rans, lans;
vector<long long> ll[maxn], vv[maxn];
void shift(long long id) {
  lazy[id * 2] += lazy[id];
  lazy[id * 2 + 1] += lazy[id];
  seg[id * 2] += lazy[id];
  seg[id * 2 + 1] += lazy[id];
  lazy[id] = 0;
}
void upd(long long s, long long e, long long id, long long l, long long r,
         long long val) {
  if (s >= l && e <= r) {
    seg[id] += val;
    lazy[id] += val;
    return;
  }
  if (s >= r || e <= l) return;
  shift(id);
  long long mid = (s + e) / 2;
  upd(s, mid, id * 2, l, r, val);
  upd(mid, e, id * 2 + 1, l, r, val);
  seg[id] = max(seg[id * 2], seg[id * 2 + 1]);
}
long long get(long long s, long long e, long long id) {
  if (e - s == 1) return s;
  shift(id);
  long long mid = (s + e) / 2;
  if (seg[id * 2] > seg[id * 2 + 1]) return get(s, mid, id * 2);
  return get(mid, e, id * 2 + 1);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> L[i] >> V[i] >> R[i];
    ll[L[i]].push_back(i);
    vv[V[i]].push_back(i);
  }
  for (long long i = 0; i < maxn; i++) {
    for (long long j = 0; j < ll[i].size(); j++) {
      upd(1, maxn, 1, V[ll[i][j]], R[ll[i][j]] + 1, 1);
    }
    if (seg[1] > ans) {
      ans = seg[1];
      lans = i;
      rans = get(1, maxn, 1);
    }
    for (long long j = 0; j < vv[i].size(); j++) {
      upd(1, maxn, 1, V[vv[i][j]], R[vv[i][j]] + 1, -1);
    }
  }
  cout << ans << endl;
  for (long long i = 0; i < n; i++) {
    if (L[i] <= lans && R[i] >= rans && V[i] <= rans && V[i] >= lans)
      cout << i + 1 << " ";
  }
}
