#include <bits/stdc++.h>
int main() {
  int n, sn, p, c;
  std::vector<int> v;
  while (std::cin >> n) {
    if (!n) return 0;
    for (; n; n--) {
      std::cin >> sn >> p >> c;
      if (p * c >= 1000000) v.push_back(sn);
    }
    if (v.empty())
      std::cout << "NA" << std::endl;
    else {
      std::vector<int>::iterator it = v.begin();
      while (it != v.end()) {
        std::cout << *it << std::endl;
        it++;
      }
      v.clear();
    }
  }
}
