#include<cstdio>

using namespace std;
const int target = 1000000;

int main()
{
	int data;
	while (1)
	{
		scanf_s("%d", &data);
		if (data == 0)break;
		bool hero = false;
		for (int i = 0; i < data; i++)
		{
			int num, sell, cnt;
			scanf_s("%d %d %d", num, sell, cnt);
			if (sell*cnt >= target)
			{
				printf("%d\n", num);
				hero = true;
			}
		}
		if (hero == false)
			printf("NA\n");
	}
	return 0;
}