#include <bits/stdc++.h>
using namespace std;
int n, id, p, q;
long long amount;
const long long MAX = 1000000;
int main(void) {
  while (~scanf("%d", &n)) {
    if (n == 0) break;
    vector<int> ans;
    for (int i = 0; i < n; i++) {
      scanf("%d%d%d", &id, &p, &q);
      amount = p * q;
      if (amount >= MAX) {
        ans.push_back(id);
      }
    }
    if (ans.empty()) {
      printf("NA\n");
    } else {
      for (int i = 0; i < (int)ans.size(); i++) {
        printf("%d\n", ans[i]);
      }
    }
  }
  return 0;
}
