/*Kim Jong Il*/
#include<iostream>
#include<cstdio>
using namespace std;

int main(){
  int n,id[10000],array[10000],array1[10000],i,j,count;
  
  while(1){
    count = 0;
    cin >> n;
    if(n == 0)break;
    
    for(i=0;i<n;i++){
      cin >> id[i];
	cin >> array[i];
	cin >> array1[i];
      
    }
    for(i=0;i<n;i++){
      if(array[i] * array1[i] >= 1000000){
	cout << id[i] << endl;
	count++;
      }
    }
    if(count == 0)cout << "NA" << endl;   
  }
}