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