#include <bits/stdc++.h>
using namespace std;
int n;
int ch[4001][3], sz;
queue<int> q;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ch[i][0] >> ch[i][1] >> ch[i][2];
  for (int i = 0; i < n; i++) {
    if (ch[i][2] >= 0) {
      sz++;
      for (int j = i + 1; j < n && ch[i][0]; j++) {
        if (ch[j][2] >= 0) {
          ch[j][2] -= ch[i][0];
          ch[i][0]--;
          if (ch[j][2] < 0) q.push(j);
        }
      }
      while (!q.empty()) {
        int c = q.front();
        q.pop();
        for (int j = c + 1; j < n; j++) {
          if (ch[j][2] >= 0) {
            ch[j][2] -= ch[c][1];
            if (ch[j][2] < 0) q.push(j);
          }
        }
      }
    }
  }
  cout << sz << endl;
  for (int i = 0; i < n; i++)
    if (ch[i][2] >= 0) cout << i + 1 << " ";
}
