#include <bits/stdc++.h>
int stotal = 1000000;
int main() {
  int num, sales, deal, count, i, k, n;
  while (scanf("%d", &i) != 0) {
    if (i == 0)
      return 0;
    else {
      count = 0;
      k = -1;
      while (count < i) {
        k = 0;
        scanf("%d %d %d", &num, &sales, &deal);
        if (sales * deal >= stotal) {
          printf("%d\n", num);
          k++;
          count++;
        } else {
          count++;
        }
      }
      if (k == 0) printf("NA\n");
    }
  }
  return 0;
}
