#include <bits/stdc++.h>
using namespace std;
int main() {
  int id, price, num, count;
  int sameid[4000];
  bool isBe = false, isSame = false;
  while (true) {
    cin >> count;
    if (count == 0) {
      break;
    }
    for (int i = 0; i < count; i++) {
      cin >> id >> price >> num;
      sameid[i] = id;
      for (int j = 1; j < i; j++) {
        if (id == sameid[j]) {
          isSame = true;
          break;
        }
      }
      if (price * num >= 100000 && !isSame) {
        cout << id << '\n';
        isBe = true;
      }
      isSame = false;
    }
    if (!isBe) {
      cout << "NA\n";
    }
    count = 0;
    isBe = false;
    for (int i = 0; i < count; i++) {
      sameid[i] = 0;
    }
  }
  return 0;
}
