#include <iostream>
#include <vector>

int main(){
  int n;
  while(std::cin>>n){
    if(!n)return 0;
    std::vector<int> v;
    long int team,price,number;
    for(;n;n--){
      std::cin>>team>>price>>number;
      if(price*number>=1000000)v.push_back(team);
    }
    if(v.empty())std::cout<<"NA"<<std::endl;
    else{
      std::vector<int>::iterator it = v.begin();
      while(it!=v.end()){
        std::cout<<*it<<std::endl;
        it++;
      }
    }
  }
}