#include <bits/stdc++.h>
struct data {
  int num;
  int price;
  int kazu;
};
int main(void) {
  int n;
  int i;
  int flag = 0;
  for (;;) {
    scanf("%d", &n);
    if (n == 0) break;
    struct data syain[n];
    for (i = 0; i < n; i++) {
      scanf("%d%d%d", &syain[i].num, &syain[i].price, &syain[i].kazu);
    }
    for (i = 0; i < n; i++) {
      if (syain[i].price * syain[i].kazu >= 1000000) {
        printf("%d\n", syain[i].num);
        if (flag == 0) flag++;
      }
    }
    if (flag == 0) puts("NA");
    flag = 0;
  }
  return 0;
}
