#include <iostream>

#define N 1000000

using namespace std;

int main(){
	int n;
	while(cin >> n){
		if(!n) break;
		bool chk = 0;
		for(int i = 0; i < n; i++){
			int num, val, sum;
			cin >> num >> val >> sum;
			double tmp = val * sum;
			if(tmp >= N){
				chk = 1;
				cout << num << endl;
			} 
		}
		if(!chk) cout << "NA" << endl;
	}
	return 0;
}