#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (true) {
    int user[4000];
    int usercount = 0;
    cin >> n;
    if (n == 0) {
      break;
    }
    long long int buf[3];
    for (int i = 0; i < n; i++) {
      cin >> buf[0] >> buf[1] >> buf[2];
      if (buf[1] * buf[2] >= 1000000) {
        user[usercount] = buf[0];
        usercount++;
      }
    }
    for (int i = 0; i < usercount; i++) {
      cout << user[i] << endl;
    }
    if (usercount == 0) {
      cout << "NA" << endl;
    }
  }
}
