
using System;
using System.Collections.Generic;
using System.Text;

class TEST{
    static void Main(){
		List<int> result = new List<int>();

		while (true)
		{
			int getNumber = int.Parse(Console.ReadLine());
			if (getNumber == 0) break;

			for (int i = 0; i < getNumber; i++)
			{
				String[] data = Console.ReadLine().Split(' ');
				int sNumber = int.Parse(data[0]);
				int sales =  (int.Parse(data[1]))*(int.Parse(data[2]));
				if (sNumber == 0){
					result.Add (0);
				}else if (sales >10000){
					result.Add (sNumber);
				}
			}
		}

		foreach(int shain in result){
			if (shain == 0){
				Console.WriteLine("NA");
			}else{
				Console.WriteLine("{0}",shain);
			}
		}
	}
}


