#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long int array[n][3];
  int count = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> array[i][0] >> array[i][1] >> array[i][2];
  }
  for (int i = 0; i < n; i++) {
    if (array[i][1] * array[i][2] >= 1000000) {
      cout << array[i][0] << "\n";
      count++;
    }
  }
  if (count == 0) cout << "NA\n";
}
