#include <bits/stdc++.h>
int main() {
  long d[4000];
  int s[4000], n, i, j, x, y, z;
  while (scanf("%ld", &n) && n != 0) {
    memset(d, 0, sizeof(d));
    for (i = 0, j = 0; i < n; i++) {
      scanf("%ld%ld%ld", &x, &y, &z);
      if (d[x] == 0) d[i] = 1000000;
      if (d[i] != -1) {
        if (z >= d[i] / y) {
          s[j++] = x;
          d[i] = -1;
        } else
          d[i] -= y * z;
      }
    }
    if (j == 0)
      printf("NA\n");
    else
      for (i = 0; i < j; i++) printf("%d\n", s[i]);
  }
  return 0;
}
