#include <bits/stdc++.h>
using namespace std;
ostream& operator<<(ostream& os, vector<int>& x) {
  for (int i = 0; i < x.size(); i++) os << x[i] << ' ';
  return os;
}
ostream& operator<<(ostream& os, pair<int, int> x) {
  cout << x.first << ' ' << x.second << ' ';
  return os;
}
struct data {
  int x, y1, y2, type;
  data(int _x, int _y1, int _y2, int _type) {
    x = _x;
    y1 = _y1;
    y2 = _y2;
    type = _type;
  }
};
bool operator<(data x, data y) {
  if (x.x == y.x) return x.type > y.type;
  return x.x < y.x;
}
int n;
pair<pair<int, int>, int> a[300005];
vector<data> query;
pair<int, int> f[4 * 300005];
int lazy[4 * 300005];
void do_lazy(int k, int l, int r) {
  if (!lazy[k]) return;
  f[k].first += lazy[k];
  if (l != r) {
    lazy[k * 2] += lazy[k];
    lazy[k * 2 + 1] += lazy[k];
  }
  lazy[k] = 0;
}
pair<int, int> get(int k, int l, int r, int L, int R) {
  do_lazy(k, l, r);
  if (r < L || R < l) return make_pair(0, 0);
  if (L <= l && r <= R) return f[k];
  int y = (l + r) / 2;
  return max(get(k * 2, l, y, L, R), get(k * 2 + 1, y + 1, r, L, R));
}
void update(int k, int l, int r, int L, int R, int val) {
  do_lazy(k, l, r);
  if (r < L || R < l) return;
  if (L <= l && r <= R) {
    f[k].first += val;
    if (l != r) {
      lazy[k * 2] += val;
      lazy[k * 2 + 1] += val;
    }
    return;
  }
  int y = (l + r) / 2;
  update(k * 2, l, y, L, R, val);
  update(k * 2 + 1, y + 1, r, L, R, val);
  f[k] = max(f[k * 2], f[k * 2 + 1]);
}
void init(int k, int l, int r) {
  if (l == r) {
    f[k].first = 0;
    f[k].second = l;
    return;
  }
  int y = (l + r) / 2;
  init(k * 2, l, y);
  init(k * 2 + 1, y + 1, r);
  f[k] = max(f[k * 2], f[k * 2 + 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    a[i].first.first = x;
    a[i].first.second = z;
    a[i].second = y;
    query.push_back(data(x, y, z, 1));
    query.push_back(data(y + 1, y, z, -1));
  }
  sort(query.begin(), query.end());
  int lim = 3e5;
  init(1, 1, lim);
  int ans = 0;
  pair<int, int> ans_pos;
  int pre = 0;
  for (int i = 0; i < query.size(); i++) {
    if (query[i].x != pre) {
      if (f[1].first > ans) {
        ans = f[1].first;
        ans_pos = make_pair(pre, f[1].second);
      }
      pre = query[i].x;
    }
    update(1, 1, lim, query[i].y1, query[i].y2, query[i].type);
  }
  cout << ans << '\n';
  for (int i = 1; i <= n; i++) {
    if (a[i].first.first <= ans_pos.first &&
        a[i].first.second >= ans_pos.second && a[i].second >= ans_pos.first &&
        a[i].second <= ans_pos.second) {
      cout << i << ' ';
    }
  }
}
