#include <iostream>
using namespace std;
int main(void) {
  int n, flag=0;
  unsigned long long man[4000], num, sale, good[4000];
  
  while(1) {
    flag = 0;
    for(int i = 0 ; i < 4000 ; i++) {
      man[i] = 0;
      good[i] = 0;
    }
    cin >> n;
    if(n == 0) break;
    for(int i = 0 ; i < n ; i++) {
      cin >> man[i] >> num >> sale;
      if(num * sale >= 1000000) { good[i] = man[i]; flag = 1; }
    }
    if(flag == 1) {
      for(int i = 0 ; i < n ; i++) {
	if(good[i] > 0) cout << good[i] << endl;
      }
    }
    else cout << "NA" << endl;
  }
  return 0;
}