#include <bits/stdc++.h>
int main(void) {
  int num;
  int employ_num;
  long long employ_money, employ_sell;
  int i;
  int flag;
  while (1) {
    scanf("%d", &num);
    if (num == 0) {
      break;
    }
    flag = 0;
    for (i = 0; i < num; i++) {
      scanf("%d%lld%lld", &employ_num, &employ_money, &employ_sell);
      if (employ_sell * employ_money >= 1000000) {
        printf("%d\n", employ_num);
        flag = 1;
      }
    }
    if (flag != 1) {
      printf("NA\n");
    }
  }
  return (0);
}
