#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  while (cin >> n) {
    if (!n) break;
    long long number[4010];
    long long sales[4010];
    for (int i = 0; i < n; i++) {
      cin >> number[i];
      long long price;
      long long bnum;
      cin >> price >> bnum;
      sales[i] = price * bnum;
    }
    int count = 0;
    for (int i = 0; i < n; i++) {
      if (sales[i] >= 1000000) {
        cout << number[i] << endl;
        count++;
      }
    }
    if (!count) cout << "NA" << endl;
  }
  return 0;
}
