#include <bits/stdc++.h>
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0) return 0;
    bool f = true;
    for (int i = 0; i < n; i++) {
      int num;
      long long a, b;
      scanf("%d %lld %lld", &num, &a, &b);
      if (a * b >= 1000000) {
        printf("%lld\n", num);
        if (f) f = false;
      }
    }
    if (f) cout << "NA" << endl;
  }
  return 0;
}
