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 maxn = 100010, maxw = 300010, maxt = 100010;
struct node {
  int l, r, v, id;
} a[maxn];
int seg[maxw << 2] = {0}, si[maxw << 2] = {0}, add[maxw << 2] = {0},
                isan[maxn] = {0};
inline void updseg(int x) {
  if (seg[(x << 1)] < seg[(x << 1 | 1)])
    si[x] = si[(x << 1 | 1)];
  else
    si[x] = si[(x << 1)];
  seg[x] = max(seg[(x << 1)], seg[(x << 1 | 1)]);
}
inline void down(int x) {
  if (add[x]) {
    add[(x << 1)] += add[x];
    add[(x << 1 | 1)] += add[x];
    seg[(x << 1)] += add[x];
    seg[(x << 1 | 1)] += add[x];
    add[x] = 0;
  }
}
void build(int l, int r, int x) {
  if (l == r) {
    si[x] = l;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, (x << 1));
  build(mid + 1, r, (x << 1 | 1));
  updseg(x);
}
void modify(int ql, int qr, int v, int l, int r, int x) {
  if (ql <= l && r <= qr) {
    seg[x] += v;
    add[x] += v;
    return;
  }
  down(x);
  int mid = (l + r) >> 1;
  if (ql <= mid) modify(ql, qr, v, l, mid, (x << 1));
  if (mid < qr) modify(ql, qr, v, mid + 1, r, (x << 1 | 1));
  updseg(x);
}
int ask(int ql, int qr, int l, int r, int x) {
  if (ql <= l && r <= qr) return seg[x];
  down(x);
  int mid = (l + r) >> 1, ret = 0;
  if (ql <= mid) ret = max(ret, ask(ql, qr, l, mid, (x << 1)));
  if (mid < qr) ret = max(ret, ask(ql, qr, mid + 1, r, (x << 1 | 1)));
  return ret;
}
int cmp(node a, node b) {
  if (a.l == b.l)
    return a.r < b.r;
  else
    return a.l < b.l;
}
int cmp2(node a, node b) { return a.id < b.id; }
struct treapnode {
  int sz, ch[2], l, r, pri, id;
} t[maxt];
int tot = 0, root = 0;
inline void upd(int x) {
  if (x) t[x].sz = t[t[x].ch[0]].sz + t[t[x].ch[1]].sz + 1;
}
inline void rot(int &x, int f) {
  int y = t[x].ch[!f];
  t[x].ch[!f] = t[y].ch[f];
  t[y].ch[f] = x;
  upd(x);
  upd(y);
  x = y;
}
void ins(int &x, int il, int ir, int id) {
  if (!x)
    t[x = ++tot] = (treapnode){1, {0, 0}, il, ir, rand(), id};
  else {
    int f = ((il < t[x].l) || ((il == t[x].l) && (ir < t[x].r)));
    ins(t[x].ch[!f], il, ir, id);
    if (t[x].pri < t[t[x].ch[!f]].pri) rot(x, f);
  }
  upd(x);
}
void del(int &x, int il, int ir) {
  if (t[x].l == il && t[x].r == ir) {
    if (!t[x].ch[0] || !t[x].ch[1])
      x = t[x].ch[0] + t[x].ch[1];
    else {
      int f = (t[t[x].ch[0]].pri > t[t[x].ch[1]].pri);
      rot(x, f);
      del(t[x].ch[f], il, ir);
    }
  } else {
    int f = ((t[x].l > il) || ((il == t[x].l) && (t[x].r > ir)));
    del(t[x].ch[!f], il, ir);
  }
  upd(x);
}
inline int getfir(int x) {
  while (t[x].ch[0]) x = t[x].ch[0];
  return x;
}
int n, ans = 0, mx = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &a[a[i].id = i].l, &a[i].v, &a[i].r), mx = max(mx, a[i].r);
  build(1, mx, 1);
  sort(a + 1, a + n + 1, cmp);
  int x, l, r;
  memset(t, 0, sizeof(t));
  for (int i = 1; i <= n; i++) {
    while (t[root].sz > 0) {
      x = getfir(root);
      l = t[x].l, r = t[x].r;
      if (l < a[i].l) {
        modify(l, r, -1, 1, mx, 1);
        del(root, l, r);
      } else
        break;
    }
    modify(a[i].v, a[i].r, 1, 1, mx, 1);
    ins(root, a[i].v, a[i].r, a[i].id);
    ans = max(ans, seg[1]);
  }
  printf("%d\n", ans);
  memset(seg, 0, sizeof(seg));
  memset(add, 0, sizeof(add));
  memset(t, 0, sizeof(t));
  tot = root = 0;
  for (int i = 1; i <= n; i++) {
    while (t[root].sz > 0) {
      x = getfir(root);
      l = t[x].l, r = t[x].r;
      if (l < a[i].l) {
        modify(l, r, -1, 1, mx, 1);
        isan[t[x].id] = 0;
        del(root, l, r);
      } else
        break;
    }
    modify(a[i].v, a[i].r, 1, 1, mx, 1);
    ins(root, a[i].v, a[i].r, a[i].id);
    isan[a[i].id] = 1;
    if (seg[1] == ans) break;
  }
  sort(a + 1, a + n + 1, cmp2);
  for (int i = 1; i <= n; i++)
    if (isan[i])
      if (!(a[i].v <= si[1] && si[1] <= a[i].r)) isan[i] = 0;
  for (int i = 1; i <= n; i++) {
    if (isan[i]) {
      ans--;
      printf("%d", i);
      if (ans) putchar(' ');
    }
  }
  return 0;
}