#include <bits/stdc++.h>
int main(void) {
  int n;
  int i, j;
  int id, value, num;
  int c;
  int name[4000], name_num;
  while (1) {
    scanf("%d", &n);
    if (!n) break;
    c = 0;
    name_num = 0;
    for (i = 0; i < n; i++) {
      scanf("%d %d %d", &id, &value, &num);
      if (1000000.0 / value - (double)num < 1e-10) {
        for (j = 0; j < name_num; j++)
          if (name[j] == id) break;
        if (j == name_num) {
          name_num++;
          name_num = id;
          printf("%d\n", id);
          c++;
        }
      }
    }
    if (!c) printf("NA\n");
  }
  return 0;
}
