#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, n, i, f;
  while (cin >> n && n) {
    int m[4000];
    f = 0;
    for (i = 0; i < n; i++) {
      cin >> a >> b >> c;
      if (b * c >= 1000000) {
        m[f] = a;
        f++;
      }
    }
    if (f <= 0)
      cout << "NA" << endl;
    else
      for (i = 0; i < f; i++) cout << m[i] << endl;
  }
}
