#include<iostream>
#include<vector>
using namespace std;

int main(void){
	int n,count=0;
	vector<int> vec1,vec2,vec3,vec4;
	//½l©
	cin >> n;
	//lªf[^üêéæÁ
	for(int i=0;i<n;i++){
		int j,m,l;
		cin >> j >> m >> l;
		vec1.push_back(j);
		vec2.push_back(m);
		vec3.push_back(l);
	}
	//ÊÌ\¦
	for(int i=0;i<n;i++){
		if(vec2[i]*vec3[i]>=1000000){
			cout << vec1[i] << endl;
			count++;
		}
	}
	if(count==0){
		cout << "NA" << endl;
	}
	
	return 0;
}