#include <bits/stdc++.h>
using namespace std;
struct P {
  int id;
  int tanka;
  int kosuu;
};
int main() {
  int n;
  while (cin >> n && n) {
    vector<P> data(n);
    for (int i = 0; i < (n); i++) {
      cin >> data[i].id >> data[i].tanka >> data[i].kosuu;
    }
    bool found = false;
    for (int i = 0; i < (n); i++) {
      long long total = (long long)data[i].tanka * data[i].kosuu;
      if (total >= 1000000LL) {
        cout << data[i].id << endl;
        if (!found) found = true;
      }
    }
    if (!found) {
      cout << "NA" << endl;
    }
  }
  return 0;
}
