#include <iostream>
using namespace std;

struct data{
	int id;
	int value;
	int num;
};

int main(){
	int n;
	int need;
	while(cin >> n){
		if(n == 0) break;
		int count = 0;
		for(int i = 0; i < n; i++){
			data d;
			cin >> d.id >>
				d.value >> d.num;
			if(d.value){
				need = 1000000 % d.value == 0 ? 1000000 / d.value : 1000000 / d.value + 1;
				if(d.num >= need){
					cout << d.id << endl;
					count++;
				}
			}
		}
		if(!count) cout << "NA" << endl;
	}
	return 0;
}