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

int main(void)
{
	int n;
	while (cin >> n, n){
		int a, b, c;
		vector <int> v;
		for (int i = 0; i < n; i++){
			cin >> a >> b >> c;
			if (1000000 <= b * c) v.push_back(a);
		}
		for (int i = 0; i < v.size(); i++){
			cout << v[i] << endl;
		}
		if (v.size() == 0) puts("NA");
	}
	
	return 0;
}