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