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

int main(void){
	vector<int> vec1,vec2,vec3,number2;
	int n,count=0;
	cin >> n;
	for(int i=0;i<n;i++){
		int number,count,buy;
		cin >> number >> count >> buy;
		vec1.push_back(number);
		vec2.push_back(count);
		vec3.push_back(buy);
	}
	for(int i=0;i<n;i++){
		if(vec2[i]*vec3[i]>1000000){
			number2.push_back(vec1[i]);
			count++;
		}
	}
	if(count>0){
		for(int i=0;i<number2.size();i++){
			cout << number2[i] << endl;
		}
	}else{
		cout << "NA" << endl;
	}
	return 0;
}