#include <bits/stdc++.h>
int main(void) {
  int n = 0;
  int i = 0;
  int tanka[4001] = {0};
  int hito[4001] = {0};
  int flg = 0;
  int uriage[4001] = {0};
  int bangou[4001] = {0};
  int ccc = 0;
  while (true) {
    flg = 0;
    ccc = 0;
    scanf("%d", &n);
    if (n == 0) {
      break;
    }
    for (i = 1; i <= n; i++) {
      ccc++;
      scanf("%d %d %d", &bangou[ccc], &tanka[ccc], &uriage[ccc]);
    }
    for (i = 1; i <= ccc; i++) {
      if (tanka[i] * uriage[i] >= 1000000) {
        printf("%d\n", bangou[i]);
        flg = 1;
      }
    }
    if (flg == 0) {
      printf("NA\n");
    }
  }
  return 0;
}
