#include <bits/stdc++.h>
typedef struct {
  int nam;
  int sum;
  int sales;
  int total;
} set;
int main() {
  int n, i, cnt = 0, over[4000] = {};
  set clerk[4000];
  while (scanf("%d", &n)) {
    if (n == 0) {
      break;
    }
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &clerk[i].nam, &clerk[i].sum, &clerk[i].sales);
      clerk[i].total = clerk[i].sum * clerk[i].sales;
    }
    for (i = 0; i < n; i++) {
      if (clerk[i].total >= 1000000) {
        printf("%d\n", clerk[i].nam);
        cnt++;
      }
    }
    if (cnt == 0) {
      printf("NA\n");
    }
    cnt = 0;
  }
  return 0;
}
