#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> staffNumber;
  vector<int> sellingPrice;
  vector<int> qty;
  int count = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int sN, sP, qt;
    cin >> sN >> sP >> qt;
    staffNumber.push_back(sN);
    sellingPrice.push_back(sP);
    qty.push_back(qt);
  }
  for (int i = 0; i < n; i++) {
    if (sellingPrice[i] * qty[i] >= 1000000) {
      cout << staffNumber[i] << endl;
      count++;
    }
  }
  if (count == 0) {
    cout << "NA" << endl;
  }
  return 0;
}
