#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int No;
  long long int value, num;
  long long int mas;
  int a[4000];
  while (true) {
    cin >> n;
    if (n == 0) break;
    int x = 0;
    for (int i = 0; i < n; i++) {
      cin >> No >> value >> num;
      mas = value * num;
      if (mas >= 1000000) {
        a[x] = No;
        x++;
      }
    }
    if (x == 0)
      cout << "NA" << '\n';
    else
      for (int i = 0; i < x; i++) cout << a[i] << '\n';
  }
  return 0;
}
