#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, l, a, k, u, s[4000];
  while (1) {
    cin >> n;
    if (n == 0) {
      break;
    }
    l = 0;
    for (i = 0; i < n; i++) {
      cin >> a >> k >> u;
      if (1000000 <= k * u) {
        s[l] = a;
        l++;
      }
    }
    if (l == 0) {
      cout << "NA" << endl;
    } else {
      for (i = 0; i < l; i++) {
        cout << s[i] << endl;
      }
    }
  }
}
