#include <bits/stdc++.h>
using namespace std;
const int BORDER = 1000000;
int main() {
  int n;
  while (cin >> n && n) {
    int id, unit, amount, cnt = 0;
    int* list = new int[n];
    for (int i = 0; i < n; ++i) {
      cin >> id >> unit >> amount;
      if (unit * amount >= BORDER) {
        list[cnt] = id;
        ++cnt;
      }
    }
    if (cnt != 0) {
      for (int i = 0; i < cnt; ++i) {
        cout << list[i] << endl;
      }
    } else {
      cout << "NA" << endl;
    }
    delete[] list;
  }
  return 0;
}
