#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 

using namespace std;

int main()
{
	int n,a,f;
	long long b,c;

	while(1){
		f=1;
		cin>>n; if(n==0) return 0;

		for(int i=0;i<n;i++){
			cin>>a>>b>>c;
			if(b*c>=1000000){ cout<<a<<endl; f=0;}
		}
		if(f) cout<<"NA"<<endl;
	}
}