#include <iostream>
#include <vector>

using namespace std;

struct person
{
	int id;
	int price;
	int number;
};

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<person> P(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> P[i].id >> P[i].price >> P[i].number;
		}
		bool flag = true;
		for(int i = 0; i < n; ++i)
		{
			unsigned long long int amount = P[i].price * P[i].number;
			if(amount >= 1000000)
			{
				cout << P[i].id << endl;
				flag = false;
			}
		}
		if(flag)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}