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

namespace Volume1_0100
{
    class Program
    {
        static void Main(string[] args)
        {
            int dataNum;
            var dataQueue = new Queue<List<Worker>>();

            while ((dataNum = int.Parse(Console.ReadLine())) != 0)
            {
                var workers = new List<Worker>();

                for (int i = 0; i < dataNum; i++)
                {
                    int[] data = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

                    var worker = new Worker()
                    {
                        Number = data[0],
                        UnitCost = data[1],
                        SoldQuantity = data[2]
                    };

                    workers.Add(worker);
                }

                dataQueue.Enqueue(workers);
            }

            foreach (var workers in dataQueue)
            {
                var goodWorkers = workers.Where(w => w.CalculateMoney() >= 1000000);

                foreach (var goodWorker in goodWorkers)
                {
                    Console.WriteLine(goodWorker.Number);
                }

                if (goodWorkers.Count() < 1)
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }

    class Worker
    {
        public int Number { get; set; }
        public int UnitCost { get; set; }
        public int SoldQuantity { get; set; }

        public int CalculateMoney()
        {
            return UnitCost * SoldQuantity;
        }

    }
}