#include <bits/stdc++.h>
int main() {
  while (1) {
    int bango[10000] = {0}, tanka[100010] = {0}, suryo[100010] = {0}, i, j, n,
        a = 0, b, c, d;
    scanf("%d", &n);
    if (n == 0) break;
    for (i = 0; i < n; i++) scanf("%d %d %d", &bango[i], &tanka[i], &suryo[i]);
    for (i = 0; i < n; i++) {
      if (tanka[i] * suryo[i] >= 1000000) {
        printf("%d\n", bango[i]);
        a++;
      }
    }
    if (a == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
