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

namespace ConsoleApplication36
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                List<int> s = new List<int>();
                int a = int.Parse(Console.ReadLine());
                if (a == 0) break;
                for (int b = 0; b < a; b++)
                {
                    int[] c = Console.ReadLine().Split().Select(int.Parse).ToArray();
                    if (c[1] * c[2] >= 1000000) s.Add(c[0]);
                }
                if (s.Count == 0) Console.WriteLine("NA");
                else foreach (int u in s) Console.WriteLine(u);
            }
        }
    }
}