#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=4005,M=1000000;
map<int,int> m;
signed main(void){
	int n,flag;
	ios::sync_with_stdio(false);
	while(cin>>n&&n){
		m.clear();
		flag=1;
		for(int i=1,x,y,z;i<=n;i++){
			cin>>x>>y>>z;
			m[x]+=y*z;
		}
		for(map<int,int>::iterator it=m.begin();it!=m.end();++it)
			if(it->second>=M)
				cout<<it->first<<endl,flag=0;
		if(flag)
			cout<<"NA"<<endl;
	}
}