#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n, n) {
    bool f = false;
    for (int i = 0; i < (int)(n); i++) {
      string a;
      long long b, c;
      cin >> a >> b >> c;
      if (b * c >= (long long)1000000) {
        cout << a << endl;
        f = true;
      }
    }
    if (!f) cout << "NA" << endl;
  }
  return 0;
}
