#include<iostream>
#include<map>
using namespace std;
int main(){
    int n;
    while(cin>>n,n){
        map<int,long long int>M;
        while(n--){
            int a,b,c;
            cin>>a>>b>>c;

            M[a]=(long long)b*c;;
        }

        bool flag=true;
        for(map<int,long long int>::iterator ite=M.begin();ite!=M.end();ite++){
            if(ite->second>=1000000){
                cout<<ite->first<<endl;
                flag=false;
            }
        }
        if(flag)cout<<"NA"<<endl;
    }
    return 0;
}