Gennady is one of the best child dentists in Berland. Today *n* children got an appointment with him, they lined up in front of his office.

All children love to cry loudly at the reception at the dentist. We enumerate the children with integers from 1 to *n* in the order they go in the line. Every child is associated with the value of his cofidence *p*<sub class="lower-index">*i*</sub>. The children take turns one after another to come into the office; each time the child that is the first in the line goes to the doctor.

While Gennady treats the teeth of the *i*-th child, the child is crying with the volume of *v*<sub class="lower-index">*i*</sub>. At that the confidence of the first child in the line is reduced by the amount of *v*<sub class="lower-index">*i*</sub>, the second one — by value *v*<sub class="lower-index">*i*</sub> - 1, and so on. The children in the queue after the *v*<sub class="lower-index">*i*</sub>-th child almost do not hear the crying, so their confidence remains unchanged.

If at any point in time the confidence of the *j*-th child is less than zero, he begins to cry with the volume of *d*<sub class="lower-index">*j*</sub> and leaves the line, running towards the exit, without going to the doctor's office. At this the confidence of all the children after the *j*-th one in the line is reduced by the amount of *d*<sub class="lower-index">*j*</sub>.

All these events occur immediately one after the other in some order. Some cries may lead to other cries, causing a chain reaction. Once in the hallway it is quiet, the child, who is first in the line, goes into the doctor's office.

Help Gennady the Dentist to determine the numbers of kids, whose teeth he will cure. Print their numbers in the chronological order.
The first line of the input contains a positive integer *n* (1 ≤ *n* ≤ 4000) — the number of kids in the line. 

Next *n* lines contain three integers each *v*<sub class="lower-index">*i*</sub>, *d*<sub class="lower-index">*i*</sub>, *p*<sub class="lower-index">*i*</sub> (1 ≤ *v*<sub class="lower-index">*i*</sub>, *d*<sub class="lower-index">*i*</sub>, *p*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">6</sup>) — the volume of the cry in the doctor's office, the volume of the cry in the hall and the confidence of the *i*-th child.
"""
Codeforces Round #325 (Div. 2)

Problem 586 C. Gennady the Dentist


@author yamaton
@date 2015-11-09
"""

import itertools as it
import functools
import operator
import collections
import math
import sys





def solve(triples):

    def queue_map(state):
        if not state:
            return []

        rest = state[1:]
        treated, _ = state[0]
        v = triples[treated][0]

        n = len(rest)
        for k in range(v):
            if k < n:
                rest[k][1] -= v - k
            else:
                break

        while any(child[1] < 0 for child in rest):
            for k in range(len(rest)):
                if rest[k][1] < 0:
                    i, _ = rest[k]
                    d = triples[i][1]
                    heard = [[i, p - d] for (i, p) in rest[k+1:]]
                    rest = rest[:k] + heard
                    break

        return treated, rest


    state = [[i, p] for i, (_, _, p) in enumerate(triples)]
    result = []
    while state:
        i, state = queue_map(state)
        result.append(i)
    return [x + 1 for x in result]


def main():
    n = int(input())
    vdp_triples = [[int(i) for i in input().strip().split()] for _ in range(n)]
    assert len(vdp_triples[0]) == 3
    result = solve(vdp_triples)
    print(len(result))
    print(' '.join(str(n) for n in result))


if __name__ == '__main__':
    main()
