#include <bits/stdc++.h>
int main() {
  int n = 1, i, x[4000] = {}, xx[4000] = {}, xxx[4000] = {}, r, y = 0;
  while (n > 0) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &x[i], &xx[i], &xxx[i]);
    }
    for (r = 0; r < 4000; r++) {
      if (xx[r] * xxx[r] > 1000000) {
        printf("%d\n", x[r], y++);
      }
    }
    if (y == 0) {
      printf("NA\n");
      (y = 0);
    }
  }
  return 0;
}
