#include <bits/stdc++.h>
struct syain {
  int e;
  int p;
  int q;
};
int main() {
  struct syain s[1000] = {0};
  int n;
  int i;
  int count = 0;
  int na = 0;
  while (scanf("%d ", &n) != -1 || na >= 50) {
    na += n;
    for (i = na - n; i < na; i++) {
      scanf("%d %d %d ", &s[i].e, &s[i].p, &s[i].q);
    }
    for (i = na - n; i < na; i++) {
      if (s[i].p * s[i].q >= 1000000) {
        printf("%d\n", s[i].e);
        count++;
      }
    }
    if (count == 0) {
      printf("NA\n");
    }
    count = 0;
  }
  return 0;
}
