#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  int n;
  while (cin >> n, n) {
    long long ban, tan, suu;
    bool flag = true;
    for (int i = (0); i <= (n - 1); ++i) {
      cin >> ban >> tan >> suu;
      if (tan * suu >= 1000000) {
        cout << ban << endl;
        flag = false;
      }
    }
    if (flag) {
      cout << "NA" << endl;
    }
  }
  return 0;
}
