#include <iostream>
using namespace std;
int main( void )
{
	int n;
	while ( cin >> n && n )
	{
		int no;
		int price;
		int deal;

		bool f = true;
		for ( int i = 0; i < n; i++ )
		{
			cin >> no >> price >> deal;
			if ( price * deal >= 1000000 )
			{
				cout << no << endl;
				f = false;
			}
		}

		if ( f )
			cout << "NA" << endl;

	}

	return 0;
}