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