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