#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define MAX_N 4001

int main(void){
  int n;
  bool flag[MAX_N], f;
  unsigned long long man[MAX_N], price, figure;
  
  while(cin >> n, n){
    memset(flag, false, sizeof(flag));
    f = false;
    
    for(int i = 0 ; i < n ; i++){
      cin >> man[i] >> price >> figure;
      if(price * figure >= 1000000) flag[i] = true;
    }
    
    for(int i = 0 ; i < n ; i++){
      if(flag[i] == true){
	cout << man[i] << endl;
	f = true;
      }
    }
    if(f == false) cout << "NA" << endl;
  }
  return 0;
}