#include <bits/stdc++.h>
struct data {
  int a;
  int b;
  int c;
};
int main(void) {
  struct data base[50];
  int n, i, u, count = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d %d", &base[i].a, &base[i].b, &base[i].c);
  }
  for (i = 0; i > n; i++) {
    u = (base[i].b) * (base[i].c);
    if (u >= 1000000) {
      printf("%d\n", base[i].a);
      count++;
    }
  }
  if (count == 0) {
    printf("NA\n");
  }
  return 0;
}
