#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0) break;
    int id, price, amount;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      cin >> id >> price >> amount;
      if (price * amount >= 10000) {
        vector<int>::iterator itr = find(v.begin(), v.end(), id);
        if (itr == v.end()) {
          v.push_back(id);
        }
      }
    }
    if (v.empty()) {
      cout << "NA" << endl;
    } else {
      for (int i = 0; i < v.size(); i++) {
        cout << v[i] << endl;
      }
    }
  }
  return 0;
}
