#include <iostream>
using namespace std;
int main(){
  int i, n, q;
  long long int p;
  while(cin >> n, n){
    bool NAflg = false;
    while(n--){
      cin >> i >> p >> q;
      if((p * q) >= static_cast<int>(1e6)){
	cout << i << endl;
	NAflg = true;
      }
    }
    if(NAflg)
      cout << "NA" << endl;
  }
  return 0;
}