#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f *= -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 1) + (x << 3) + s - '0';
    s = getchar();
  }
  return x * f;
}
struct itn {
  int l, v, r, id;
} a[100005];
struct bol {
  bool operator()(itn x, itn y) { return x.r > y.r; }
};
inline bool cmp(itn x, itn y) { return x.v < y.v; }
int n = read(), ans = 0, L, R, m, f[300005 * 3], ml[300005 * 3], lz[300005 * 3],
    p;
inline void add(int l, int r, int d) {
  for (l = p + l - 1, r = p + r + 1; (l ^ 1) != r;) {
    if ((l & 1) ^ 1) f[l ^ 1] += d, lz[l ^ 1] += d;
    if (r & 1) f[r ^ 1] += d, lz[r ^ 1] += d;
    l >>= 1, r >>= 1;
    if (f[l << 1] >= f[l << 1 | 1])
      f[l] = f[l << 1] + lz[l], ml[l] = ml[l << 1];
    else
      f[l] = f[l << 1 | 1] + lz[l], ml[l] = ml[l << 1 | 1];
    if (f[r << 1] >= f[r << 1 | 1])
      f[r] = f[r << 1] + lz[r], ml[r] = ml[r << 1];
    else
      f[r] = f[r << 1 | 1] + lz[r], ml[r] = ml[r << 1 | 1];
  }
  for (l >>= 1; l > 0; l >>= 1) {
    if (f[l << 1] >= f[l << 1 | 1])
      f[l] = f[l << 1] + lz[l], ml[l] = ml[l << 1];
    else
      f[l] = f[l << 1 | 1] + lz[l], ml[l] = ml[l << 1 | 1];
  }
}
int main() {
  for (int i = 1; i <= n; i++)
    a[i].l = read(), a[i].v = read(), a[i].r = read(), a[i].id = i,
    m = max(m, a[i].r);
  sort(a + 1, a + 1 + n, cmp);
  for (p = 1; p <= m + 1; p <<= 1)
    ;
  for (int i = p + 1; i <= p + m; i++) ml[i] = i - p;
  for (int i = p - 1; i > 0; i--) ml[i] = ml[i << 1];
  priority_queue<itn, vector<itn>, bol> s;
  for (int r = 1, d = 0; r <= m; r++) {
    while (d < n && a[d + 1].v <= r) d++, add(a[d].l, a[d].v, 1), s.push(a[d]);
    while (!s.empty() && s.top().r < r) add(s.top().l, s.top().v, -1), s.pop();
    if (f[1] > ans) ans = f[1], L = ml[1], R = r;
  }
  printf("%d\n", ans, L, R);
  for (int i = 1; i <= n; i++)
    if (a[i].l <= L && a[i].r >= R && a[i].v >= L && a[i].v <= R)
      printf("%d ", a[i].id);
  putchar('\n');
  return 0;
}
