#include <bits/stdc++.h>
int main() {
  int n = 1;
  int flag = 0;
  while (n != 0) {
    scanf("%d", &n);
    int info[n][3];
    int i = 0;
    for (; i <= n - 1; i++) {
      scanf("%d%d%d", &info[i][0], &info[i][1], &info[i][2]);
    }
    i = 0;
    for (; i <= n - 1; i++) {
      if (info[i][1] * info[i][2] >= 1000000) {
        printf("%d\n", info[i][0]);
        flag = 1;
      }
    }
    if (flag == 0) printf("NA\n");
    flag = 0;
  }
  return 0;
}
