#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(!n)break;
		int num,price,amount;
		vector<int> v;
		while(n--){
			cin>>num>>price>>amount;
			if((long)price*(long)amount>=1000000)v.push_back(num);
		}
		if(!v.empty()){
			for(int i=0;i<v.size();++i)cout<<v[i]<<"\n";
		}else cout<<"NA\n";
	}
	return 0;
}