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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int count = 0;
                int n = int.Parse(Console.ReadLine());
                if (n == 0)
                {
                    break;
                }
                int[,] shachiku = new int[n, 3];
                for (int i = 0; i < n; i++)
                {
                    string[] str = Console.ReadLine().Split(' ');
                    shachiku[i, 0] = int.Parse(str[0]);
                    shachiku[i, 1] = int.Parse(str[1]);
                    shachiku[i, 2] = int.Parse(str[2]);
                }
                for (int i = 0; i < n; i++)
                {
                    if (shachiku[i, 1] * shachiku[i, 2] >= 1000000)
                    {
                        Console.WriteLine(shachiku[i, 0]);
                        count++;
                    }
                }
                if (count == 0)
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}