#include <bits/stdc++.h>
int main() {
  int n, sn, tann, un, to, cou, i;
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    cou = 0;
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &sn, &tann, &un);
      to = tann * un;
      if (to >= 1000000) {
        printf("%d\n", sn);
        cou++;
      }
    }
    if (cou == 0) printf("NA\n");
  }
  return 0;
}
