#include <bits/stdc++.h>
int main(void) {
  int n, i, j = 0, k, o, p, q;
  while (scanf("%d", &n) == 0) {
    for (i = 0; i < n; i++) {
      scanf("%d%d%d", &o, &p, &q);
      if (p * q >= 1000000) {
        j = 1;
        printf("%d\n", o);
      }
    }
    if (j == 0) printf("NA");
    j = 0;
  }
  return 0;
}
