#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum;
  while (1) {
    sum = 0;
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      int no, x, y;
      cin >> no >> x >> y;
      if (x * y >= 1000000) {
        cout << no << endl;
        sum++;
      }
    }
    if (sum == 0) cout << "NA" << endl;
  }
}
