#include <bits/stdc++.h>
using namespace std;
const int NORMA = 1000000;
int main() {
  int N;
  while (cin >> N && N) {
    map<int, int> m;
    set<int> s;
    vector<int> v;
    for (int i = 0; i < (int)(N); ++i) {
      int a, b, c;
      cin >> a >> b >> c;
      m[a] += b * c;
      if (s.find(a) == s.end()) v.push_back(a);
      s.insert(a);
    }
    vector<int> ans;
    for (int i = 0; i < (int)(v.size()); ++i)
      if (m[v[i]] >= NORMA) ans.push_back(v[i]);
    if (ans.size() == 0)
      cout << "NA" << endl;
    else
      for (int i = 0; i < (int)(ans.size()); ++i) cout << ans[i] << endl;
  }
  return 0;
}
