Problem: Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now he wants to pick n workers from the staff who will be directly responsible for developing a game.

Each worker has a certain skill level vi. Besides, each worker doesn't want to work with the one whose skill is very different. In other words, the i-th worker won't work with those whose skill is less than li, and with those whose skill is more than ri.

Pavel understands that the game of his dream isn't too hard to develop, so the worker with any skill will be equally useful. That's why he wants to pick a team of the maximum possible size. Help him pick such team.

Input

The first line contains a single integer n (1 ≤ n ≤ 105) — the number of workers Pavel hired.

Each of the following n lines contains three space-separated integers li, vi, ri (1 ≤ li ≤ vi ≤ ri ≤ 3·105) — the minimum skill value of the workers that the i-th worker can work with, the i-th worker's skill and the maximum skill value of the workers that the i-th worker can work with.

Output

In the first line print a single integer m — the number of workers Pavel must pick for developing the game.

In the next line print m space-separated integers — the numbers of the workers in any order.

If there are multiple optimal solutions, print any of them.

Examples

Input

4
2 8 9
1 4 7
3 6 8
5 8 10


Output

3
1 3 4


Input

6
3 5 16
1 6 11
4 8 12
7 9 16
2 10 14
8 13 15


Output

4
1 2 3 5

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 310000;
struct Node {
  int v, r;
  int id, nxt;
  bool operator<(const Node& o) const { return v > o.v; }
} p[MAX_N];
int head[MAX_N], e, n, m;
void addNode(int u, int v, int r) {
  p[e].v = v, p[e].r = r, p[e].nxt = head[u];
  p[e].id = e, head[u] = e++;
}
struct SegmentTree {
  int val, add;
  int l, r;
} w[MAX_N << 2];
void build(int v, int l, int r) {
  w[v].l = l, w[v].r = r, w[v].val = w[v].add = 0;
  if (l == r) return;
  int mid = l + r >> 1;
  build(v << 1, l, mid), build(v << 1 | 1, mid + 1, r);
}
void insert(int v, int l, int r, int addnum) {
  if (w[v].l == l && r == w[v].r) {
    w[v].add += addnum;
    return;
  }
  if (w[v].add) {
    w[v << 1].add += w[v].add;
    w[v << 1 | 1].add += w[v].add;
    w[v].add = 0;
  }
  int mid = w[v].l + w[v].r >> 1;
  if (mid >= r) {
    insert(v << 1, l, r, addnum);
  } else if (mid < l) {
    insert(v << 1 | 1, l, r, addnum);
  } else {
    insert(v << 1, l, mid, addnum);
    insert(v << 1 | 1, mid + 1, r, addnum);
  }
  w[v].val =
      max(w[v << 1].val + w[v << 1].add, w[v << 1 | 1].val + w[v << 1 | 1].add);
}
int query(int v) {
  if (w[v].l == w[v].r) {
    return w[v].l;
  }
  if (w[v].add) {
    w[v << 1].add += w[v].add;
    w[v << 1 | 1].add += w[v].add;
    w[v].add = 0;
  }
  int res = -1;
  if (w[v << 1].val + w[v << 1].add >= w[v << 1 | 1].val + w[v << 1 | 1].add) {
    res = query(v << 1);
  } else {
    res = query(v << 1 | 1);
  }
  w[v].val =
      max(w[v << 1].val + w[v << 1].add, w[v << 1 | 1].val + w[v << 1 | 1].add);
  return res;
}
priority_queue<Node> q;
int cnt, ans[MAX_N];
int main() {
  while (scanf("%d", &n) == 1) {
    fill(head, head + MAX_N, -1), e = 0, m = 0;
    for (int i = 0; i < n; i++) {
      int l, v, r;
      scanf("%d%d%d", &l, &v, &r);
      addNode(l, v, r);
      m = max(m, r + 1);
    }
    build(1, 1, m), cnt = 0;
    while (!q.empty()) q.pop();
    for (int i = 1; i <= m; i++) {
      while (!q.empty() && q.top().v < i) {
        insert(1, q.top().v, m, -1);
        insert(1, q.top().r + 1, m, 1);
        q.pop();
      }
      if (head[i] == -1) continue;
      for (int j = head[i]; ~j; j = p[j].nxt) {
        q.push(p[j]);
        insert(1, p[j].v, m, 1);
        insert(1, p[j].r + 1, m, -1);
      }
      cnt = max(w[1].val + w[1].add, cnt);
    }
    printf("%d\n", cnt);
    build(1, 1, m);
    fill(ans, ans + n + 1, 0);
    while (!q.empty()) q.pop();
    for (int i = 1; i <= m; i++) {
      while (!q.empty() && q.top().v < i) {
        insert(1, q.top().v, m, -1);
        insert(1, q.top().r + 1, m, 1);
        q.pop();
      }
      if (head[i] == -1) continue;
      for (int j = head[i]; ~j; j = p[j].nxt) {
        q.push(p[j]);
        insert(1, p[j].v, m, 1);
        insert(1, p[j].r + 1, m, -1);
      }
      int cr = query(1);
      if (cnt == w[1].val + w[1].add) {
        while (!q.empty()) {
          Node pre = q.top();
          q.pop();
          if (pre.v <= cr && pre.r >= cr) {
            ans[pre.id] = 1;
          }
        }
        goto OUT;
      }
    }
  OUT:
    for (int i = 0; i < n; i++) {
      if (ans[i]) {
        printf("%d ", i + 1);
      }
    }
    printf("\n");
  }
  return 0;
}