#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int i = 0;
    int na = 0;
    cin >> i;
    if (i == 0)
      break;
    else {
      for (int k = 0; k < i; k++) {
        int j = 0;
        int l = 0;
        int m = 0;
        cin >> j >> l >> m;
        if (l * m >= 1000000) {
          cout << j << endl;
          na = 1;
        }
      }
      if (na == 0) {
        cout << "NA" << endl;
      }
    }
  }
  return 0;
}
