#include <iostream>

using namespace std;

void Solution()
{
	while(true)
	{
		int n;
		int count = 0;
		int number, perPrice, amount;

		cin>>n;

		int m = n;

		if (n == 0)
		{
			break;
		}

		while(n--)
		{
			cin>>number>>perPrice>>amount;

			long long allValue = perPrice * amount;
			
			if ( allValue >= 1000000)
			{
				cout<<number<<endl;
			}
			else
			{
				count++;
			}

			if (count == m)
			{
				cout<<"NA"<<endl;
			}
		}
	}
}

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