#include <bits/stdc++.h>
int main(void) {
  struct employee {
    int N, P, A;
  };
  employee person[10][4000];
  int a, b = 0, c[10], d, e;
  for (d = 0;; b = 0, d++) {
    scanf("%d", &c[d]);
    if (c[d] == 0) {
      e = d;
      break;
    }
    for (a = 0; a < c[d]; a++)
      scanf("%d %d %d", &person[d][a].N, &person[d][a].P, &person[d][a].A);
  }
  for (d = 0; d <= e; b = 0, d++) {
    for (a = 0; a < c[d]; a++)
      if (person[d][a].P * person[d][a].A >= 1000000) {
        printf("%d\n", person[d][a].N);
        b++;
      }
    if (b == 0) printf("NA\n");
  }
}
