#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans[4000];
  double a, b;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    int i, j;
    for (i = 0, j = 0; i < n; i++) {
      int num, flag = 1;
      cin >> num >> a >> b;
      if (a / 1000000.0 * b >= 1.0) {
        for (int k = 0; k < j; k++) {
          if (ans[k] == num) flag = 0;
        }
        if (flag == 1) {
          ans[j] = num;
          j++;
        }
      }
    }
    if (j != 0) {
      for (int i = 0; i < j; i++) {
        cout << ans[i] << endl;
      }
    } else
      cout << "NA" << endl;
  }
}
