#include <bits/stdc++.h>
using namespace std;
const int target = 1000000;
int main() {
  int data;
  while (1) {
    scanf("%d", &data);
    if (data == 0) break;
    bool hero = false;
    for (int i = 0; i < data; i++) {
      int num, sell, cnt;
      scanf("%d %d %d", &num, &sell, &cnt);
      if (sell * cnt >= target) {
        printf("%d\n", num);
        hero = true;
      }
    }
    if (hero == false) printf("NA\n");
  }
  return 0;
}
