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