#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  while (scanf("%d\n", &n) != EOF) {
    vector<pair<int, long long>> v;
    vector<int> id, p, q;
    for (int i = 0; i < (n); ++i) {
      int x, y, z;
      cin >> x >> y >> z;
      id.push_back(x);
      p.push_back(y);
      q.push_back(z);
    }
    for (int i = 0; i < (n); ++i) {
      vector<pair<int, long long>>::iterator it = v.begin();
      for (; it != v.end(); ++it) {
        if ((*it).first == id.at(i)) {
          (*it).second += p.at(i) * q.at(i);
          break;
        }
      }
      if (it == v.end()) {
        v.push_back(make_pair(id.at(i), (long long)p.at(i) * q.at(i)));
      }
    }
    bool flag = false;
    for (vector<pair<int, long long>>::iterator it = v.begin(); it != v.end();
         ++it) {
      if ((*it).second >= 1000000) {
        flag = true;
        cout << (*it).first << endl;
      }
    }
    if (!flag) cout << "NA" << endl;
  }
  return 0;
}
