#include <bits/stdc++.h>
using namespace std;
int main() {
  std::list<int> Anslist;
  int e[4001], p[100000], q[1000000], n;
  while (cin >> n) {
    if (n == 0) break;
    for (int i = 0, j = 0; i < n; i++) {
      cin >> e[i] >> p[i] >> q[i];
      if (p[i] * q[i] >= 1000000) {
        Anslist.push_back(e[i]);
        j++;
      }
    }
  }
  if (Anslist.empty()) {
    cout << "NA" << endl;
  } else {
    list<int>::iterator it = Anslist.begin();
    while (it != Anslist.end()) {
      cout << *it << endl;
      it++;
    }
  }
  return 0;
}
