#include <bits/stdc++.h>
using namespace std;
class meb {
 public:
  int num;
  int tanka;
  int count;
};
int main() {
  int n, m, t, c;
  while (1) {
    int cc = 0;
    cin >> n;
    meb st[n];
    if (n == 0) return 0;
    for (int i = 0; i < n; i++) {
      cin >> st[i].num >> st[i].tanka >> st[i].count;
    }
    for (int j = 0; j < n; j++) {
      if ((st[j].tanka) * (st[j].count) >= 1000000)
        cout << st[j].num << endl;
      else
        cc++;
    }
    if (cc == n) cout << "NA" << endl;
  }
  return 0;
}
