#include <bits/stdc++.h>
int main() {
  int i, j, k;
  int a, b, flag;
  while (scanf("%d", &a) != EOF) {
    flag = 0;
    for (b = 0; b < a; b++) {
      scanf("%d %d %d", &i, &j, &k);
      if (j * k >= 1000000) {
        printf("%d\n", i);
        flag = 1;
      } else if (flag == 0) {
        printf("NA\n");
      }
    }
  }
  return (0);
}
