#include <bits/stdc++.h>
int main(void) {
  int n;
  int i;
  int b[4001] = {0}, c[4001] = {0};
  int a[4001] = {0};
  int d[4001];
  int count = 0;
  while (scanf("%d", &n)) {
    if (n == 0) {
      break;
    }
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &a[i], &b[i], &c[i]);
    }
    for (i = 0; i < n; i++) {
      if (b[i] * c[i] >= 1000000) {
        d[i] = a[i];
        count++;
      }
    }
    if (count == 0) {
      printf("NA\n");
    }
    for (i = 0; i <= count; i++) {
      if (d[i] != 0) {
        printf("%d\n", d[i]);
        d[i] = 0;
      }
    }
  }
  return 0;
}
