#include <bits/stdc++.h>
struct KOUZOUTAI0100 {
  int no;
  int tanka;
  int kazu;
  int sum;
};
int main() {
  int i;
  int set;
  int count;
  struct KOUZOUTAI0100 data[4000];
  while (1) {
    scanf("%d", &set);
    if (set == 0) {
      break;
    }
    count = 0;
    for (i = 0; i < set; i++) {
      scanf("%d %d %d", &data[i].no, &data[i].tanka, &data[i].kazu);
      data[i].sum = (data[i].tanka) * (data[i].kazu);
      if (data[i].sum >= 1000000) {
        printf("%d\n", data[i].no);
        count++;
      }
    }
    if (count == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
