#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  while (cin >> n && n) {
    long long no;
    long long price;
    long long deal;
    vector<long long> V;
    map<long long, long long> P;
    bool f = true;
    for (int i = 0; i < n; i++) {
      cin >> no >> price >> deal;
      if (find(V.begin(), V.end(), no) == V.end()) V.push_back(no);
      P[no] = max(P[no], price * deal);
      if (P[no] >= 1000000) {
        f = false;
      }
    }
    if (f) {
      cout << "NA" << endl;
    } else {
      for (vector<long long>::iterator it = V.begin(); it != V.end(); it++) {
        if (P[*it] >= 1000000) {
          cout << *it << endl;
        }
      }
    }
  }
  return 0;
}
