#include<iostream>
using namespace std;

int main(){
	int a,hoge;
	bool flag;
	while(1){
		cin >> a;
		if(a == 0) break;
		int number[a];
		int tanka[a];
		int ryo[a];
		int gokei[a];
		flag = false;
		for(int i=0;i<a;i++){
			cin >> number[i] >> tanka[i] >> ryo[i];
			gokei[i] = tanka[i] * ryo[i];
			if(gokei[i] >= 1000000){
				cout << number[i] << endl;
				flag = true;
			}
		}
		if(flag == false) cout << "NA" << endl;
	}
	return 0;
}