#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>

#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

typedef long long ll;

int main(){
  int n;
  while(cin>>n, n){
    bool f = false;
    REP(i,n){
      string a;
      ll b,c;
      cin>>a>>b>>c;
      if(b*c >= (ll)1000000){
	cout << a << endl;
	f = true;
      }
    }
    if(!f) cout << "NA" << endl;
  }
  return 0;
}