#include<stdio.h>

int main(){

	int n=1, i, x[3][4000] = {},  y=0;

	for (n = 1; n > 0;n++){
		
		scanf("%d", &n);if (n == 0){ break; }

		for (i = 0; i < n; i++){
			scanf("%d %d %d",&x[0][i],&x[1][i],&x[2][i]);
		}
		for (i = 0; i < n; i++){
			if (x[1][i] * x[2][i] > 1000000){
				printf("%d\n", x[0][i],y++);
			}	
		}
		if (y == 0){ printf("NA\n"); y = 0; };
	}
	return 0;
}