#include<iostream>
using namespace std;

#define SHINE_MAX 4000
#define ELITE 1000000
#define AHO "NA"

int shineN;
int eliteN;
int elite[SHINE_MAX];

int num,tanka,suryo;
int i;

int main(){
	while(1){
	 cin>>shineN;
	 if(shineN==0){break;}
	 
	 eliteN=0;
	 for(i=0;i<shineN;i++){
	  cin>>num>>tanka>>suryo;
	  if(ELITE<=tanka*suryo){	//??¨???????????????
	   elite[eliteN]=num;
	   eliteN++;
	  }
	 }
	 
	 //??¨???????????????
	 for(i=0;i<eliteN;i++){
	  cout<<elite[i];
	 }
	 if(eliteN==0){cout<<AHO;}
	}
	return 0;
}