#include <bits/stdc++.h>
int main() {
  int no[50], pri[50], num[50], i = 0, j, a, n;
  while (scanf("%d", &n) != 0) {
    while (n) {
      scanf("%d %d %d", &no[i], &pri[i], &num[i]);
      i++;
      n--;
    }
    for (j = 0; j < i; j++)
      if (pri[j] * num[j] >= 1000000) {
        printf("%d\n", no[j]);
        n++;
      }
    if (n == 0) printf("NA\n");
  }
  return 0;
}
