#include <bits/stdc++.h>
using namespace std;
void desperate_optimization(int precision) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
struct people {
  int l, r, v;
};
const int N = 3e5;
struct dat {
  int maxi;
  int id;
};
int lazy[4 * N + 5];
dat ST[4 * N + 5];
people arr[N + 5];
vector<pair<int, int> > lst;
priority_queue<pair<int, int> > timeline;
inline void pushdown(int idx) {
  if (lazy[idx] == 0) return;
  ST[2 * idx].maxi += lazy[idx];
  ST[2 * idx + 1].maxi += lazy[idx];
  lazy[2 * idx] += lazy[idx];
  lazy[2 * idx + 1] += lazy[idx];
  lazy[idx] = 0;
}
inline dat merge(dat A, dat B) {
  dat C;
  if (A.maxi == B.maxi) {
    C.maxi = A.maxi;
    C.id = max(A.id, B.id);
    return C;
  }
  C.maxi = max(A.maxi, B.maxi);
  if (C.maxi == A.maxi)
    C.id = A.id;
  else
    C.id = B.id;
  return C;
}
void build(int idx, int left, int right) {
  if (left == right) {
    ST[idx].maxi = 0;
    ST[idx].id = left;
    return;
  }
  int mid = (left + right) / 2;
  build(2 * idx, left, mid), build(2 * idx + 1, mid + 1, right);
  ST[idx] = merge(ST[2 * idx], ST[2 * idx + 1]);
}
void update(int idx, int left, int right, int l, int r, int val) {
  if (r < left || right < l) return;
  if (l <= left && right <= r) {
    ST[idx].maxi += val;
    lazy[idx] += val;
    return;
  }
  pushdown(idx);
  int mid = (left + right) / 2;
  update(2 * idx, left, mid, l, r, val);
  update(2 * idx + 1, mid + 1, right, l, r, val);
  ST[idx] = merge(ST[2 * idx], ST[2 * idx + 1]);
}
dat zero;
dat query(int idx, int left, int right, int l, int r) {
  if (right < l || r < left) return zero;
  if (l <= left && right <= r) return ST[idx];
  pushdown(idx);
  int mid = (left + right) / 2;
  return merge(query(2 * idx, left, mid, l, r),
               query(2 * idx + 1, mid + 1, right, l, r));
}
void hora(int tc) {
  zero.maxi = 0, zero.id = N;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].l >> arr[i].v >> arr[i].r;
    lst.push_back({arr[i].l, i});
  }
  sort(lst.begin(), lst.end());
  int maxi = -1, idr = -1, idl = -1;
  build(1, 1, N);
  for (int i = 0; i < lst.size(); i++) {
    int waktu = lst[i].first;
    int id = lst[i].second;
    while (!timeline.empty() && -timeline.top().first < waktu) {
      int cur_id = timeline.top().second;
      update(1, 1, N, arr[cur_id].v, arr[cur_id].r, -1);
      timeline.pop();
    }
    update(1, 1, N, arr[id].v, arr[id].r, 1);
    dat res = query(1, 1, N, waktu, N);
    if (res.maxi > maxi) {
      maxi = res.maxi;
      idl = waktu, idr = res.id;
    }
    timeline.push({-arr[id].v, id});
  }
  int ctr = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i].l <= idl && idr <= arr[i].r && idl <= arr[i].v &&
        arr[i].v <= idr)
      ctr++;
  }
  assert(ctr == maxi);
  cout << maxi << '\n';
  for (int i = 1; i <= n; i++) {
    if (arr[i].l <= idl && idr <= arr[i].r && idl <= arr[i].v &&
        arr[i].v <= idr)
      cout << i << " ";
  }
}
int main() {
  desperate_optimization(10);
  int ntc = 1;
  for (int tc = 1; tc <= ntc; tc++) hora(tc);
  return 0;
}
