#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void smin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void smax(T &a, T b) {
  if (a < b) a = b;
}
const int maxn = 100 * 1000 + 100;
const int RANGE = 3 * 100 * 1000 + 100;
int n;
pair<pair<int, int>, pair<int, int> > LVR[maxn], VLR[maxn];
int add_val[4 * RANGE], max_val[4 * RANGE];
void add_range(int x, int nl, int nr, int ql, int qr, int val) {
  if (nr <= ql || qr <= nl) return;
  if (ql <= nl && nr <= qr) {
    add_val[x] += val;
    max_val[x] += val;
    return;
  }
  add_val[2 * x + 1] += add_val[x], max_val[2 * x + 1] += add_val[x];
  add_val[2 * x + 2] += add_val[x], max_val[2 * x + 2] += add_val[x];
  add_val[x] = 0;
  int nm = (nl + nr) / 2;
  add_range(2 * x + 1, nl, nm, ql, qr, val);
  add_range(2 * x + 2, nm, nr, ql, qr, val);
  max_val[x] = max(max_val[2 * x + 1], max_val[2 * x + 2]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0, _n = (int)(n); i < _n; i++) {
    cin >> LVR[i].first.first >> LVR[i].first.second >> LVR[i].second.first;
    LVR[i].second.first++;
    LVR[i].second.second = i;
    VLR[i] = LVR[i];
    swap(VLR[i].first.first, VLR[i].first.second);
  }
  sort(LVR, LVR + n);
  sort(VLR, VLR + n);
  int pos = 0;
  int ans = 0, ind = 0;
  for (int i = 0, _n = (int)(n); i < _n; i++) {
    while (pos < n && LVR[pos].first.first <= VLR[i].first.first)
      add_range(0, 0, RANGE, LVR[pos].first.second, LVR[pos].second.first, 1),
          pos++;
    if (max_val[0] >= ans) ans = max_val[0], ind = i;
    add_range(0, 0, RANGE, VLR[i].first.first, VLR[i].second.first, -1);
  }
  cout << ans << endl;
  vector<int> LS, RS;
  for (int i = (int)(ind), _n = (int)(n); i < _n; i++)
    if (VLR[i].first.second <= VLR[ind].first.first &&
        VLR[i].first.first < VLR[ind].second.first)
      LS.push_back(VLR[i].first.first), RS.push_back(VLR[i].second.first);
  sort((LS).begin(), (LS).end()), sort((RS).begin(), (RS).end());
  int max_cur = -1, max_i = -1, cur = 0;
  pos = 0;
  for (int i = 0, _n = (int)((int((LS).size()))); i < _n; i++) {
    while (pos < (int((RS).size())) && RS[pos] <= LS[i]) cur--, pos++;
    cur++;
    if (max_cur < cur) max_cur = cur, max_i = i;
  }
  cerr << " @@ " << max_cur << ' ' << LS[max_i] << endl;
  for (int i = (int)(ind), _n = (int)(n); i < _n; i++)
    if (VLR[i].first.second <= VLR[ind].first.first &&
        VLR[i].first.first < VLR[ind].second.first &&
        VLR[i].first.first <= LS[max_i] && LS[max_i] < VLR[i].second.first)
      cout << VLR[i].second.second + 1 << ' ';
  cout << endl;
  {
    int _;
    cin >> _;
    return 0;
  }
}
