#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (!n) break;
    bool chk = 0;
    for (int i = 0; i < n; i++) {
      int num, val, sum;
      cin >> num >> val >> sum;
      double tmp = val * sum;
      if (tmp >= 1000000) {
        chk = 1;
        cout << num << endl;
      }
    }
    if (!chk) cout << "NA" << endl;
  }
  return 0;
}
