using System;
using System.Collections.Generic;

namespace AOJ_SaleResult
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, int> dict = new Dictionary<int,int>();
            int datasize;
            datasize = int.Parse(Console.ReadLine());
            for(int i=0;i<datasize;i++)
            {
                string buf;
                string[] splitdata;
                buf = Console.ReadLine();
                splitdata = buf.Split(' ');
                if(dict.ContainsKey(int.Parse(splitdata[0])))
                {
                    dict[int.Parse(splitdata[0])] += int.Parse(splitdata[1]) * int.Parse(splitdata[2]);
                }
                else 
                {
                    dict.Add(int.Parse(splitdata[0]), int.Parse(splitdata[1])*int.Parse(splitdata[2]));
                }
            }
            foreach(int key in dict.Keys)
            {
                if (dict[key] >= 1000000)
                    Console.WriteLine(key);
            }
        }
    }
}