#include <iostream>
using namespace std;
typedef struct{
	int number;
	long long sales;
} staff;

int main(void)
{
	int n;
	while(cin>>n){
		if(!n) break;
		staff staff1[4001];
		for(int i=0; i< n; i++){
			cin >> staff1[i].number;
			long price;
			int bnum;
			cin >> price >> bnum;
			staff1[i].sales = price * bnum;
		}
		int count = 0;
		for(int i=0; i < n; i++){
			if(staff1[i].sales >= 1000000){
				count++;
				cout << staff1[i].number << endl;
			}
		}
		if(!count) cout << "NA" << endl;
	}
	
	return 0;
}