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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = "";
            while ((line = Console.ReadLine()) != "0")
            {
                bool flag = false;
                int max = int.Parse(line);
                for (int i = 0; i < max; i++)
                {
                    String[] arg = Console.ReadLine().Split(' ');
                    int _a = int.Parse(arg[1]);
                    int _b = int.Parse(arg[2]);
                    if (_a * _b >= 1000000)
                    {
                        Console.WriteLine(arg[0]);
                        flag = true;
                    }
                }
                if (!flag) Console.WriteLine("NA");
            }
        }
    }
}