#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    bool f = false;
    int e[4000], p[4000], q[4000], t[4000];
    for (int i = 0; i < n; i++) {
      cin >> e[i];
      cin >> p[i];
      cin >> q[i];
      t[i] = p[i] * q[i];
    }
    for (int a = 0; a < n; a++) {
      if (t[a] >= 1000000) {
        cout << e[a] << endl;
        f = true;
      }
    }
    if (!f) {
      cout << "NA" << endl;
    }
  }
  return 0;
}
