#include <bits/stdc++.h>
int main(void) {
  int a[4001], b, c[4001], d[4001], i, all, cou;
  long long int ALL = 1000000;
  for (;;) {
    cou = 0;
    scanf("%d", &b);
    if (b == 0) break;
    for (i = 0; i < b; i++) {
      scanf("%d %d %d", &a[i], &c[i], &d[i]);
    }
    for (i = 0; i < b; i++) {
      all = c[i] * d[i];
      if (all >= ALL) {
        printf("%d\n", a[i]);
        cou = cou + 1;
      }
    }
    if (cou == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
