#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
template <class T>
T RoundOff(T a) {
  return int(a + .5 - (a < 0));
}
template <class T, class C>
void chmax(T& a, C b) {
  if (a < b) a = b;
}
template <class T, class C>
void chmin(T& a, C b) {
  if (b < a) a = b;
}
template <class T, class C>
pair<T, C> mp(T a, C b) {
  return make_pair(a, b);
}
int main() {
  int n;
  while (cin >> n) {
    if (!n) break;
    bool f = true;
    for (int i = 0; i < n; i++) {
      int a, s, num;
      cin >> num >> a >> s;
      if (1000000 <= a * s) {
        f = false;
        cout << num << endl;
      }
    }
    if (f) cout << "NA" << endl;
  }
}
