#include <bits/stdc++.h>
int main() {
  int goodworker[4000], nogw;
  int num, price, amount;
  int datas, i;
  while (1) {
    nogw = 0;
    scanf("%d", &datas);
    if (datas == 0) return 0;
    for (i = 0; i < datas; i++) {
      scanf("%d %d %d", &num, &price, &amount);
      if (price * amount >= 1000000) goodworker[nogw++] = num;
    }
    if (nogw != 0) {
      for (i = 0; i < nogw; i++) {
        printf("%d\n", goodworker[i]);
      }
    } else {
      printf("NA\n");
    }
  }
}
