#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, flag;
  int num[5000], pz[5000], kazu[5000];
  for (;;) {
    cin >> n;
    if (n == 0) break;
    flag = 0;
    for (i = 0; i < n; i++) cin >> num[i] >> pz[i] >> kazu[i];
    for (i = 0; i < n; i++) {
      if (pz[i] * kazu[i] >= 1000000) {
        cout << num[i] << endl;
        flag = 1;
      }
    }
    if (flag != 1) cout << "NA" << endl;
  }
  return 0;
}
