#include <bits/stdc++.h>
int main() {
  int a, i, fl;
  unsigned long int b, c;
  while (1) {
    scanf("%d", &i);
    fl = 0;
    for (int j = 0; j < i; j++) {
      scanf("%d", &a);
      if (a == 0) {
        return 0;
      }
      scanf("%ld", &b);
      scanf("%ld", &c);
      if (a * c >= 1000000) {
        fl = 1;
        printf("%d\n", a);
      }
      if (fl == false) printf("NA\n");
    }
  }
}
