#include <bits/stdc++.h>
int main(void) {
  int a, b, c, d;
  int i, j, k;
  int count;
  count = 0;
  for (;;) {
    count = 0;
    scanf("%d", &a);
    if (a > 0 && a < 4000) {
      for (i = 0; i < a; i++) {
        scanf("%d%d%d", &b, &c, &d);
        if (c * d >= 1000000) {
          printf("b=%d\n", b);
          count++;
          printf("c=%d d=%d\n", c, d);
        }
      }
      if (count == 0) printf("NA\n");
    } else
      break;
  }
  return 0;
}
