#include<iostream>
using namespace std;
int main(void) {
	int a, b, c,d,e=0,f=0;
	while(1){
		cin >> a;
		if (a == 0) break;
		while (1) {
			cin >> b >> c >> d;
			if (c*d >= 1000000) {
				cout << b << endl;
				e++;
			}
			f++;
			if (a == f) break;
		}
		if (e == 0) cout << "NA\n";
		f = 0;
		e = 0;
	}
}