#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  while (n != 0) {
    int i;
    bool flag = false;
    for (i = 0; i < n; i++) {
      int id, price, num;
      scanf("%d %d %d", &id, &price, &num);
      int quota = int(1000000 / price + 0.999999999);
      if (num >= quota) {
        printf("%d\n", id);
        flag = true;
      }
    }
    if (flag == false) printf("%s\n", "NA");
    scanf("%d", &n);
  }
  return 0;
}
