#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 10000;
const long long int INF = 1000000010;
const long long int LINF = 1000000000000000010;
const int MAX = 100001;
int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dp[310][310][610];
int main() {
  int n;
  while (cin >> n) {
    bool f = true;
    for (int i = 0; i < n; i++) {
      long long int e, p, q;
      cin >> e >> p >> q;
      if (p * q >= 1000000) {
        f = true;
        cout << e << endl;
      }
    }
    if (f) {
      cout << "NA" << endl;
    }
  }
  return 0;
}
