#include <iostream>
#include <map>
using namespace std;
int main()
{
    int n;
    while(1)
    {
        cin>>n;if(n==0)return 0;
        int count=0;
        multimap<int,int> sl;
        for(int i=0;i<n;++i){
            int sn,t,v;
            cin>>sn>>t>>v;
            sl.insert(pair<int,int>(sn,t*v));
        }
        map<int,int>::iterator it=sl.begin();
        while(it!=sl.end())
        {
            if((*it).second>=1000000){cout<<(*it).first<<endl;++count;}
            ++it;
        }
        if(count==0)cout<<"NA"<<endl;
    }
}