#include <iostream>
#include <string>
using namespace std;

int main()
{
	int n,id,sale,k,cnt;
	int outid[4001];
	while (1)
	{
		cin >> n;
		if (n == 0)break;
		cnt = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> id >> sale >> k;
			if (sale*k >= 1000000)
			{
				cnt++;
				outid[cnt] = id;
			}
		}
		if (cnt==0)
		{
			cout << "NA" << endl;
		}
		else
		{
			for (int i = 1; i <= cnt; i++)
			{
				cout << outid[i] << endl;
			}
		}
	}
	return 0;
}