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