#include <iostream>
#include <map>

using namespace std;

int main() {
	int num;
	int LINE = 1000000;

	while(cin>>num, num!=0){
		map<int, long long> employees;
		map<int, long long>::iterator itr;
		bool flg = false;
		for(int i=0; i<num; i++){
			int id =0, q=0, p=0;
			cin>>id>>q>>p;
			employees[id] += (q*p);
		}


		for(itr = employees.begin(); itr != employees.end(); itr++){
			if(itr->second >= LINE){
				cout<<itr->first<<endl;
				flg = true;
			}
		}
		if(!flg){
			cout<<"NA"<<endl;
		}
	}
	return 0;
}