#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  bool flag[4001], f;
  unsigned long long man[4001], price, figure;
  while (cin >> n, n) {
    memset(flag, false, sizeof(flag));
    f = false;
    for (int i = 0; i < n; i++) {
      cin >> man[i] >> price >> figure;
      if (price * figure >= 1000000) flag[i] = true;
    }
    for (int i = 0; i < n; i++) {
      if (flag[i] == true) {
        cout << man[i] << endl;
        f = true;
      }
    }
    if (f == false) cout << "NA" << endl;
  }
  return 0;
}
