#include<iostream>
using namespace std;

int main()
{
	int num, yen, ko;
	int c = 0;
	
	while (1){
		cin >> num;
		if (!num)	break;

		for (; num > 0; num--){
			cin >> num >> yen >> ko;

			if (yen * ko >= 1000000){
				cout << num << endl;
				c++;
			}
		}

		if (c == 0)
			cout << "NA" << endl;
	}

	return 0;
}