#include<stdio.h>

int main(){

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

	while (n > 0){
		scanf("%d", &n);

		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] > 999999){
				printf("%d\n", x[0][i],y++);
			}	
		}
		if (y == 0){ printf("NA\n"); } (y = 0);
	}
	return 0;
}