#include <bits/stdc++.h>
using namespace std;
const int MAXN = 600005;
int n;
struct node {
  int l, v, r;
} nd[MAXN];
int tree[MAXN * 2];
int lazy[MAXN * 2];
void push(int node, int st, int ed) {
  tree[node] += lazy[node];
  if (st != ed) {
    lazy[node * 2] += lazy[node];
    lazy[node * 2 + 1] += lazy[node];
  }
  lazy[node] = 0;
}
void update(int node, int st, int ed, int l, int r, int val) {
  push(node, st, ed);
  if (st > r || ed < l) {
    return;
  }
  if (st >= l && ed <= r) {
    lazy[node] += val;
    push(node, st, ed);
    return;
  }
  update(node * 2, st, (st + ed) / 2, l, r, val);
  update(node * 2 + 1, (st + ed) / 2 + 1, ed, l, r, val);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}
int query(int node, int st, int ed, int l, int r) {
  push(node, st, ed);
  if (st > r || ed < l) {
    return 0;
  }
  if (st >= l && ed <= r) {
    return tree[node];
  }
  auto L = query(node * 2, st, (st + ed) / 2, l, r);
  auto R = query(node * 2 + 1, (st + ed) / 2 + 1, ed, l, r);
  return max(L, R);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> nd[i].l >> nd[i].v >> nd[i].r;
  }
  vector<pair<int, int> > event;
  for (int i = 1; i <= n; i++) {
    event.push_back(make_pair(nd[i].l, -i));
    event.push_back(make_pair(nd[i].v, i));
  }
  sort(event.begin(), event.end());
  int ans = 0;
  for (int i = 0; i < event.size(); i++) {
    int idx = event[i].second;
    if (idx < 0) {
      idx *= -1;
      update(1, 1, 300000, nd[idx].v, nd[idx].r, 1);
      ans = max(ans, query(1, 1, 300000, 1, 300000));
    } else {
      update(1, 1, 300000, nd[idx].v, nd[idx].r, -1);
      ans = max(ans, query(1, 1, 300000, 1, 300000));
    }
  }
  memset(tree, 0, sizeof(tree));
  memset(lazy, 0, sizeof(lazy));
  set<int> id;
  vector<int> go;
  int temp = 0;
  cout << ans << "\n";
  for (int i = 0; i < event.size(); i++) {
    int idx = event[i].second;
    if (idx < 0) {
      idx *= -1;
      id.insert(idx);
      update(1, 1, 300000, nd[idx].v, nd[idx].r, 1);
      temp = max(temp, query(1, 1, 300000, 1, 300000));
      if (temp == ans) {
        int q = 0;
        for (int j = 1; j <= 300000; j++) {
          if (query(1, 1, 300000, j, j) == temp) {
            q = j;
            break;
          }
        }
        for (auto it : id) {
          if (nd[it].v <= q && nd[it].r >= q) {
            go.push_back(it);
          }
        }
        for (auto x : go) {
          cout << x << ' ';
        }
        exit(0);
      }
    } else {
      id.erase(idx);
      update(1, 1, 300000, nd[idx].v, nd[idx].r, -1);
      temp = max(temp, query(1, 1, 300000, 1, 300000));
    }
  }
  return 0;
}
