#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) {
      break;
    }
    vector<int> res;
    for (int i = (int)(0); i < (int)(n); i++) {
      int no, price, num;
      cin >> no >> price >> num;
      if (1000000 <= price * num) {
        res.push_back(no);
      }
    }
    if (res.size() == 0) {
      cout << "NA" << endl;
    } else {
      for (int &no : res) {
        cout << no << endl;
      }
    }
  }
  return 0;
}
