#include <bits/stdc++.h>
struct employees {
  int i;
  int p;
  int q;
};
int main(void) {
  int n, m, x, y, z;
  struct employees number[4000] = {0};
  scanf("%d", &m);
  n = 0;
  while (scanf("%d %d %d", &x, &y, &z) != EOF) {
    if (x == 0) break;
    if (x <= 4000 && y <= 1000000 && z <= 100000) {
      number[n].i = x;
      number[n].p = y;
      number[n].q = z;
      n++;
    }
    if (m <= n) break;
  }
  for (n = 0, m = 0; n < 4000; n++) {
    if (number[n].i == 0) break;
    if (number[n].q * number[n].p >= 1000000) {
      printf("%d\n", number[n].i);
      m++;
    }
  }
  if (m == 0) printf("NA\n");
  return 0;
}
