#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  int LINE = 1000000;
  while (cin >> num, num != 0) {
    vector<int> employees;
    int id = 0, q = 0, p = 0;
    for (int i = 0; i < num; i++) {
      cin >> id >> q >> p;
      if (q * p >= LINE) {
        employees.push_back(id);
      }
    }
    if (employees.size() == 0) {
      cout << "NA" << endl;
      continue;
    }
    for (int i = 0; i < employees.size(); i++) {
      cout << employees.at(i) << endl;
    }
  }
  return 0;
}
