#include<iostream>
#include<vector>
#include<map>
#define SALES_GOAL 1000000
using namespace std;
int main(void){
  int i,n;
  while(cin>>n,n){
    int tof = 1;
    int num;
    long long price,qua;
    map<int,long long> staff;
    map<int,long long>::iterator itr;
    while(n-- > 0){
      cin >> num >> price >> qua;
      staff[num] += price*qua;

    }
    for(itr = staff.begin(); itr != staff.end(); itr++){

      if(itr->second >= SALES_GOAL){
        cout << itr->first << endl;
        tof = 0;
      }
      
    }
    if(tof)cout << "NA" << endl;
    
  }


}