#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 310000;
struct Node {
  int v, r;
  int id, nxt;
  bool operator<(const Node& o) const { return v > o.v; }
} p[MAX_N];
int head[MAX_N], e, n, m;
void addNode(int u, int v, int r) {
  p[e].v = v, p[e].r = r, p[e].nxt = head[u];
  p[e].id = e, head[u] = e++;
}
struct SegmentTree {
  int val, add;
  int l, r;
} w[MAX_N << 2];
void build(int v, int l, int r) {
  w[v].l = l, w[v].r = r, w[v].val = w[v].add = 0;
  if (l == r) return;
  int mid = l + r >> 1;
  build(v << 1, l, mid), build(v << 1 | 1, mid + 1, r);
}
void insert(int v, int l, int r, int addnum) {
  if (w[v].l == l && r == w[v].r) {
    w[v].add += addnum;
    return;
  }
  if (w[v].add) {
    w[v << 1].add += w[v].add;
    w[v << 1 | 1].add += w[v].add;
    w[v].add = 0;
  }
  int mid = w[v].l + w[v].r >> 1;
  if (mid >= r) {
    insert(v << 1, l, r, addnum);
  } else if (mid < l) {
    insert(v << 1 | 1, l, r, addnum);
  } else {
    insert(v << 1, l, mid, addnum);
    insert(v << 1 | 1, mid + 1, r, addnum);
  }
  w[v].val =
      max(w[v << 1].val + w[v << 1].add, w[v << 1 | 1].val + w[v << 1 | 1].add);
}
int query(int v) {
  if (w[v].l == w[v].r) {
    return w[v].l;
  }
  if (w[v].add) {
    w[v << 1].add += w[v].add;
    w[v << 1 | 1].add += w[v].add;
    w[v].add = 0;
  }
  int res = -1;
  if (w[v << 1].val + w[v << 1].add >= w[v << 1 | 1].val + w[v << 1 | 1].add) {
    res = query(v << 1);
  } else {
    res = query(v << 1 | 1);
  }
  w[v].val =
      max(w[v << 1].val + w[v << 1].add, w[v << 1 | 1].val + w[v << 1 | 1].add);
  return res;
}
priority_queue<Node> q;
int cnt, ans[MAX_N];
int main() {
  while (scanf("%d", &n) == 1) {
    fill(head, head + MAX_N, -1), e = 0, m = 0;
    for (int i = 0; i < n; i++) {
      int l, v, r;
      scanf("%d%d%d", &l, &v, &r);
      addNode(l, v, r);
      m = max(m, r + 1);
    }
    build(1, 1, m), cnt = 0;
    while (!q.empty()) q.pop();
    for (int i = 1; i <= m; i++) {
      while (!q.empty() && q.top().v < i) {
        insert(1, q.top().v, m, -1);
        insert(1, q.top().r + 1, m, 1);
        q.pop();
      }
      if (head[i] == -1) continue;
      for (int j = head[i]; ~j; j = p[j].nxt) {
        q.push(p[j]);
        insert(1, p[j].v, m, 1);
        insert(1, p[j].r + 1, m, -1);
      }
      cnt = max(w[1].val + w[1].add, cnt);
    }
    printf("%d\n", cnt);
    build(1, 1, m);
    fill(ans, ans + n + 1, 0);
    while (!q.empty()) q.pop();
    for (int i = 1; i <= m; i++) {
      while (!q.empty() && q.top().v < i) {
        insert(1, q.top().v, m, -1);
        insert(1, q.top().r + 1, m, 1);
        q.pop();
      }
      if (head[i] == -1) continue;
      for (int j = head[i]; ~j; j = p[j].nxt) {
        q.push(p[j]);
        insert(1, p[j].v, m, 1);
        insert(1, p[j].r + 1, m, -1);
      }
      int cr = query(1);
      if (cnt == w[1].val + w[1].add) {
        while (!q.empty()) {
          Node pre = q.top();
          q.pop();
          if (pre.v <= cr && pre.r >= cr) {
            ans[pre.id] = 1;
          }
        }
        goto OUT;
      }
    }
  OUT:
    for (int i = 0; i < n; i++) {
      if (ans[i]) {
        printf("%d ", i + 1);
      }
    }
    printf("\n");
  }
  return 0;
}
