#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;

int n,num,cost,mon;

int main(){
	while(1){
		cin>>n;
		if(n==0) break;
		bool tmp=false;
		for(int i=0;i<n;i++){
			cin>>num>>cost>>mon;
			if((long long int)cost*mon>=1000000){
				cout<<num<<endl;
				tmp=true;
			}
		}
		if(!tmp) cout<<"NA"<<endl;
	}
}