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