#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
struct tree {
  pair<int, int> x;
  int upd;
  tree* left;
  tree* right;
  tree(int l, int r) {
    this->x = {0, l};
    this->upd = 0;
    this->left = nullptr;
    this->right = nullptr;
  }
};
struct dot {
  tree* root;
  dot() { root = new tree(1, 1); }
  void push(tree* root, int l, int r) {
    if (l > r) return;
    if (l == r) {
      if (root->upd) {
        root->x.first += root->upd;
        root->upd = 0;
      }
      return;
    }
    int m = (l + r) / 2;
    if (root->left == nullptr) root->left = new tree(l, m);
    if (root->right == nullptr) root->right = new tree(m + 1, r);
    if (root->upd) {
      root->left->upd += root->upd;
      root->right->upd += root->upd;
      root->x.first += root->upd;
      root->upd = 0;
    }
  }
  void upd(tree* root, int l, int r, int l1, int r1, int x) {
    push(root, l, r);
    if (l > r || l1 > r || r1 < l) return;
    if (l == l1 && r == r1) {
      root->upd += x;
      push(root, l, r);
      return;
    }
    int m = (l + r) / 2;
    upd(root->left, l, m, l1, min(r1, m), x);
    upd(root->right, m + 1, r, max(m + 1, l1), r1, x);
    if (root->left->x.first > root->right->x.first)
      root->x = root->left->x;
    else
      root->x = root->right->x;
  }
  pair<int, int> mx(tree* root, int l, int r, int l1, int r1) {
    push(root, l, r);
    if (l > r || l1 > r || r1 < l) return {-1, -1};
    if (l == l1 && r == r1) return root->x;
    int m = (l + r) / 2;
    pair<int, int> x = mx(root->left, l, m, l1, min(r1, m));
    pair<int, int> y = mx(root->right, m + 1, r, max(m + 1, l1), r1);
    if (x.first > y.first) return x;
    return y;
  }
};
const int maxn = 2e5 + 113;
bool used[maxn];
void solve(vector<pair<pair<int, int>, int>> in, dot& ms) {
  vector<pair<int, int>> te;
  for (int i = 0; i < in.size(); i++) {
    te.push_back({in[i].first.first, i});
    te.push_back({in[i].second + 1, i});
  }
  sort(te.begin(), te.end());
  reverse(te.begin(), te.end());
  int ans = 0;
  int L, R;
  for (int le = 1; le <= 3e5; le++) {
    while (te.size() && te.back().first == le) {
      if (!used[te.back().second]) {
        used[te.back().second] = 1;
        ms.upd(ms.root, 1, 3e5, in[te.back().second].second,
               in[te.back().second].first.second, 1);
      } else {
        used[te.back().second] = 0;
        ms.upd(ms.root, 1, 3e5, in[te.back().second].second,
               in[te.back().second].first.second, -1);
      }
      te.pop_back();
    }
    pair<int, int> t = ms.mx(ms.root, 1, 3e5, 1, 3e5);
    if (ans < t.first) {
      ans = t.first;
      L = le, R = t.second;
    }
    if (!te.size()) break;
  }
  cout << ans << "\n";
  for (int i = 0; i < in.size(); i++) {
    if (in[i].first.first <= L && in[i].first.second >= R &&
        in[i].second >= L && in[i].second <= R)
      cout << i + 1 << " ";
  }
  return;
}
signed main() {
  srand(1337);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  vector<pair<pair<int, int>, int>> in;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    in.push_back({{a, c}, b});
  }
  dot ms;
  solve(in, ms);
  return 0;
}
