#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n,b,m,s,l,d[4000];
  for(;;){
    cin>>n;
    if(n==0)
      break;
    l=0;
    for(i=0;i<n;i++){
      cin>>b>>m>>s;
      if((long long)m*(long long)s>=1000000){
	d[l]=b;
	l++;
      }
    }
    if(l){
      for(i=0;i<l;i++)
	cout<<d[i]<<endl;
    }else
      cout<<"NA"<<endl;
  }
  return 0;
}