#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  while (cin >> n && n) {
    long long no;
    long long price;
    long long deal;
    bool f = true;
    for (int i = 0; i < n; i++) {
      cin >> no >> price >> deal;
      if (price * deal >= 1000000) {
        cout << no << endl;
        f = false;
      }
    }
    if (f) cout << "NA" << endl;
  }
  return 0;
}
