#include<iostream>
using namespace std;

int main(){
  const int Sale = 1000000;
  while(true){
    int n; //????????°
    int counter = 0;
    cin >> n;
    if(n == 0){
      break;
    }
    int id[n],sale[n],result[n];
    for(int i=0; i<n; i++){
      cin >> id[i] >>sale[i] >> result[i];
      if(sale[i]*result[i] >= Sale){
        cout << id[i] << endl;
        counter++;
      }
    }
    if(counter == 0){
        cout << "NA" << endl;
    }
  }
}