#include <bits/stdc++.h>
using namespace std;
int main() {
  const int AIM = 1000000;
  int n;
  int num, per, sum;
  bool exist;
  while (true) {
    scanf("%d", &n);
    if (n == 0) break;
    exist = false;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d", &num, &per, &sum);
      if ((long long)per * sum >= AIM) {
        exist = true;
        printf("%d\n", num);
      }
    }
    if (!exist) printf("NA\n");
  }
  return 0;
}
