#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  int id[n];
  int p[n];
  int q[n];
  int num = 0;
  for (int i = 0; i < n; i++) {
    cin >> id[i] >> p[i] >> q[i];
    if (p[i] * q[i] >= 1000000) {
      cout << id[i];
      num++;
    }
  }
  if (num == 0) {
    cout << "NA";
  }
  return 0;
}
