#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n), n) {
    bool printed = false;
    for (int i = 0; i < int(n); ++i) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      if (1000000 <= b * c) {
        printf("%d\n", a);
        printed = true;
      }
    }
    if (!printed) puts("NA");
  }
  return 0;
}
