#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int main() {
  long long t, s;
  int n;
  for (; cin >> n, n;) {
    bool f = false;
    for (int i = 0; i < n; i++) {
      int p;
      cin >> p >> t >> s;
      if (t * s >= 1000000) cout << p << endl, f = true;
    }
    if (!f) cout << "NA\n";
  }
  return 0;
}
