#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	bool a[4001], f;
	long long int s, t, u;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		fill(a, a+4001, false);
		f = true;
		for(int i = 0; i < n; i++){
			cin >> s >> t >> u;
			if(a[s]){
				continue;
			}
			a[s] = true;
			
			if(t*u >= 1000000){
				cout << s << endl;
				f = false;
			}
		}
		if(f){
			cout << "NA" << endl;
		}
	}
	
	return 0;
}