#include <bits/stdc++.h>
int main(void) {
  int i, n, e[1000];
  long int p[1000], q[1000];
  int out[50][4000] = {0};
  int cnt = 0;
  do {
    do {
      scanf("%d", &n);
    } while (n > 1000 || n < 0);
    for (i = 0; i < n; i++) {
      do {
        scanf("%d %ld %ld", &e[i], &p[i], &q[i]);
      } while ((e[i] < 1 || e[i] > 4000) || (p[i] < 0 || p[i] > 1000000) ||
               (q[i] < 0 || q[i] > 1000000));
      if (p[i] * q[i] >= 1000000) {
        out[cnt][i] = e[i];
      }
    }
    cnt++;
  } while (n > 0 || cnt > 50);
  printf("\n");
  for (i = 0; i < cnt - 1; i++) {
    if (out[i][0] == 0) {
      printf("NA\n");
    } else {
      int j = 0;
      while (out[i][j]) {
        printf("%d ", out[i][j]);
        j++;
      }
      printf("\n");
    }
  }
  return 0;
}
