#include <bits/stdc++.h>
int main() {
  int n;
  while (std::cin >> n) {
    if (!n) return 0;
    std::vector<int> v;
    int team, price, number;
    for (; n; n--) {
      std::cin >> team >> price >> number;
      if (price * number >= 1000000) v.push_back(team);
    }
    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++;
      }
    }
  }
}
