#include<iostream>
#define SALES_GOAL 1000000 
using namespace std;
int main(void){
  int i,n;
  int price,qua;
  while(cin>>n,n){
    int tof = 1;
    int staff_info[n];
    for(i=0;i<n;i++){
      cin >> staff_info[i] >> price >> qua;
      staff_info[i] = price>SALES_GOAL && qua? staff_info[i]
                      :price*qua>SALES_GOAL ? staff_info[i] : 0;
    }
    for(i=0;i<n;i++){
      if(staff_info[i]){
        cout<<staff_info[i]<<endl;
        tof=false;
      }
    }
    if(tof){
        cout << "NA\n";
    }
  }
}