#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
  while(1){
    int n;
    bool f = true;
    cin >> n;
    if(!n) break;
    for(int i = 0; i < n; i++){
      int a,b,c;
      cin >> a >> b>> c;
      if(1000000 <= b*c){
	cout << a << endl;
	f = false;
      }
    }
    if(f) puts("NA");
  }
}