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