#include <bits/stdc++.h>
int main() {
  int i, n, no, flag, tmp;
  int data[4000];
  long long int price, num;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    memset(data, 0, sizeof(data));
    tmp = 0;
    for (i = 0; i < n; i++) {
      scanf("%d %lld %lld", &no, &price, &num);
      if (price * num >= 1000000) {
        data[tmp++] = no;
      }
    }
    for (i = 0; i < tmp; i++) {
      printf("%d\n", data[i]);
    }
    if (tmp == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
