#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long nArr[4005][3];
  bool chk[4005] = {false};
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> nArr[i][0] >> nArr[i][1] >> nArr[i][2];
  }
  int cnt = 0;
  bool endure;
  list<int> s;
  for (int i = 0; i < n; i++) {
    if (nArr[i][2] >= 0) {
      chk[i] = true;
      cnt++;
      for (int j = i + 1; j < n; j++) {
        if (nArr[j][2] >= 0) {
          nArr[j][2] -= nArr[i][0];
          if (nArr[i][0] > 0) nArr[i][0]--;
          if (nArr[j][2] < 0) s.push_back(j);
        }
      }
    }
    while (!s.empty()) {
      int e = s.front();
      s.pop_front();
      for (int j = e + 1; j < n; j++) {
        if (nArr[j][2] >= 0) {
          nArr[j][2] -= nArr[e][1];
          if (nArr[e][0] > 0) nArr[e][0]--;
          if (nArr[j][2] < 0) s.push_back(j);
        }
      }
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i < n; i++) {
    if (chk[i]) printf("%d ", i + 1);
  }
  printf("\n");
  return 0;
}
