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

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