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