#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n, n) {
    vector<int> a;
    for (int i = 0; i < n; i++) {
      int d;
      long long b, c;
      cin >> d >> b >> c;
      if (b * c >= 1000000L) a.push_back(d);
    }
    if (a.size() == 0) {
      puts("NA");
      continue;
    }
    for (int i = 0; i < (int)a.size(); i++) cout << a[i] << endl;
  }
  return 0;
}
