#include <bits/stdc++.h>
using namespace std;
int n, p = (1 << 19);
pair<pair<int, int>, pair<int, int> > w[(1 << 20)];
int rmax[(1 << 20)];
priority_queue<pair<int, int> > pq;
int rpush[(1 << 20)];
int loc[(1 << 20)];
int best = 0, bestx = 0, besty = 0;
void push(int a) {
  rmax[a] += rpush[a];
  if (a < p) {
    rpush[2 * a] += rpush[a];
    rpush[2 * a + 1] += rpush[a];
  }
  rpush[a] = 0;
}
int get_max() {
  push(1);
  return rmax[1];
}
void range_add(int x, int lo, int hi, int qlo, int qhi, int val) {
  push(x);
  if (hi < qlo || lo > qhi) return;
  if (hi <= qhi && lo >= qlo) {
    rpush[x] += val;
    push(x);
    return;
  } else {
    range_add(2 * x, lo, (hi + lo) / 2, qlo, qhi, val);
    range_add(2 * x + 1, (hi + lo) / 2 + 1, hi, qlo, qhi, val);
    if (rmax[2 * x] < rmax[2 * x + 1]) {
      rmax[x] = rmax[2 * x + 1];
      loc[x] = loc[2 * x + 1];
    } else {
      rmax[x] = rmax[2 * x];
      loc[x] = loc[2 * x];
    }
  }
}
void do_loc(int x, int lo, int hi) {
  loc[x] = lo;
  if (x >= p) return;
  do_loc(2 * x, lo, (hi + lo) / 2);
  do_loc(2 * x + 1, (hi + lo) / 2 + 1, hi);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &w[i].first.first, &w[i].first.second,
          &w[i].second.first);
    w[i].second.second = i + 1;
  }
  sort(w, w + n);
  memset(rmax, 0, sizeof(rmax));
  memset(rpush, 0, sizeof(rpush));
  memset(loc, 0, sizeof(loc));
  do_loc(1, 1, p);
  int j = 0;
  while (j < n) {
    range_add(1, 1, p, w[j].first.second, w[j].second.first, 1);
    pq.push(pair<int, int>(-w[j].first.second, j));
    while (-pq.top().first < w[j].first.first) {
      range_add(1, 1, p, w[pq.top().second].first.second,
                w[pq.top().second].second.first, -1);
      pq.pop();
    }
    if (get_max() > best) {
      best = get_max();
      bestx = w[j].first.first;
      besty = loc[1];
    }
    j++;
  }
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (w[i].first.first <= bestx && w[i].first.second >= bestx &&
        w[i].first.second <= besty && w[i].second.first >= besty) {
      ans.push_back(w[i].second.second);
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < (int)ans.size(); i++) {
    if (i != 0) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
}
