#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n, id, f = 0;
    long long price, num;
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> id >> price >> num;
      if (price * num >= 1000000) {
        cout << id << endl;
        f = 1;
      }
    }
    if (f == 0) cout << "NA" << endl;
  }
  return 0;
}
