#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  while (cin >> n && n) {
    int count = 0;
    while (n--) {
      long long no, price, sold;
      cin >> no >> price >> sold;
      if (price * sold >= 1000000) {
        cout << no << endl;
        count++;
      }
    }
    if (count == 0) cout << "NA\n";
  }
  return 0;
}
