#include<stdio.h>
long long d;

int main(){
	int n,i,num,c,k;
	int ar[4000],car;
	while(1){
		scanf("%d",&n);
		if(n==0)return 0;
		car=0;
		for(i=0;i<n;i++){
			scanf("%d %d %d",&num,&c,&k);
			d=c*k;
			if(d>=1000000)ar[car++]=num;
		}
		if(car==0)printf("NA\n");
		else{for(i=0;i<car;i++)printf("%d\n",ar[i]);}
	}
}