#include <cstdio>
#include <vector>

using namespace std;

int n, e, p, q;
vector<int> v;

int main() {
  while(scanf("%d", &n), n) {
    v.clear();
    for(int i = 0; i < n; i++) {
      scanf("%d %d %d", &e, &p, &q);
      if(p * q >= 1e6) {
        v.push_back(e);
      }
    }
    if(!v.size()) printf("NA\n");
    else for (int x : v) printf("%d\n", x);
  }
}