#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t2, t3;
  while (cin >> n && n) {
    int total[n][2];
    bool flag = false;
    for (int i = 0; i < n; i++) {
      cin >> total[i][1] >> t2 >> t3;
      total[i][0] = t2 * t3;
    }
    for (int i = 0; i < n; i++) {
      if (total[i][0] >= 1000000) {
        cout << total[i][1] << endl;
        flag = true;
      }
    }
    if (!flag) cout << "NA" << endl;
  }
}
