#include <bits/stdc++.h>
int main(void) {
  int n, staff[4000][4], counter;
  int i;
  while (1) {
    n = 0;
    counter = 0;
    scanf("%d", &n);
    if (n == 0) break;
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &staff[i][0], &staff[i][1], &staff[i][2]);
      staff[i][3] = staff[i][1] * staff[i][2];
    }
    for (i = 0; i < n; i++) {
      if (staff[i][3] >= 1000000) {
        printf("%d\n", staff[i][0]);
        counter++;
      }
    }
    if (counter == 0) printf("NA\n");
  }
  return 0;
}
