#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		int num,x,y;
		int mon=0,cnt=0;
		for(int i=0 ;i<n ;i++){
			cin >> num >> x >> y;

			mon = x*y;
			if(mon >=1000000){
				cout << num << endl;
				cnt++;
			}
		}
		if(cnt==0)
			cout << "NA" << endl;

	}
	return 0;
}