#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int>  number;
	int d,num,item,ko;
	while(cin>>d){
		if(d==0) break;
		for(int i=0;i<d;i++){
			cin>>num>>item>>ko;
			item *= ko;
			if(item>=1000000){
				number.push_back(num);
			}
		}
		if(number.size()==0) cout<<"NA"<<endl;
		else{
				for(int j=0;j<number.size();j++){
				cout<<number[j]<<endl;
			}
			number.clear();
		}
	}
}