#include <bits/stdc++.h>
int main() {
  long kazu, data[4000][3];
  long R[4000];
  long kaunto = 0;
  long i, j;
  long number = 0;
  scanf("%d", &kazu);
  while (kazu != 0) {
    for (i = 0; i < 4000; i++) {
      R[i] = 0;
    }
    for (i = 0; i < 4000; i++) {
      data[i][0] = i + 1;
    }
    for (i = 0; i < 4000; i++) {
      for (j = 1; j < 3; j++) {
        data[i][j] = 0;
      }
    }
    for (i = 0; i < kazu; i++) {
      scanf("%d", &number);
      scanf("%d %d", &data[number - 1][1], &data[number - 1][2]);
    }
    for (i = 0; i < 4000; i++) {
      if (data[i][1] * data[i][2] >= 1000000) {
        R[kaunto] = data[i][0];
        kaunto++;
      }
    }
    kaunto = 0;
    while (R[kaunto] != '\0') {
      printf("%d\n", R[kaunto]);
      kaunto++;
    }
    if (R[0] == '\0') {
      printf("NA\n");
    }
    kaunto = 0;
    scanf("%d", &kazu);
  }
  return 0;
}
