#include<iostream>

int main()
{
	int n;

	while(1)
	{
		bool isNA=true;
		std::cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++)
		{
			int number,price,amount;
			std::cin>>number>>price>>amount;
			if(price*amount>=1000000)
			{
				std::cout<<number<<std::endl;
				isNA=false;
			}
		}
		if(isNA)std::cout<<"NA"<<std::endl;
	}
	return 0;
}