#include <bits/stdc++.h>
using namespace std;
struct data {
  int id;
  int value;
  int num;
};
int main() {
  int n;
  int need;
  int officer[4000];
  while (cin >> n) {
    if (n == 0) break;
    int count = 0;
    for (int i = 0; i < n; i++) {
      data d;
      cin >> d.id >> d.value >> d.num;
      if (d.value > 0) {
        need =
            1000000 % d.value == 0 ? 1000000 / d.value : 1000000 / d.value + 1;
        if (d.num >= need) {
          count++;
          officer[count] = d.id;
        }
      }
    }
    if (!count) {
      cout << "NA" << endl;
    } else {
      for (int i = 1; i <= count; i++) cout << officer[i] << endl;
    }
  }
  return 0;
}
