#include <bits/stdc++.h>
int main() {
  int i, ryou, bangou[4000], nedan[4000], kazu[4000], check;
  while (1) {
    check = 0;
    scanf("%d", &ryou);
    if (ryou == 0) break;
    for (i = 0; i < ryou; i++) {
      scanf("%d%d%d", &bangou[i], &nedan[i], &kazu[i]);
      {
        if (nedan[i] * kazu[i] >= 1000000) {
          printf("%d", bangou[i]);
          check = 1;
        }
      }
    }
    if (check == 0) printf("NA");
  }
}
