#include <stdio.h>

int main(int argc, char *argv){
	int n, f;
	int ID, price, num;
	while(1){
		scanf("%d ", &n);
		if(!n) break;
		f=0;
		while(n--){
			scanf("%d %d %d ", &ID, &price, &num);
			if(1000000 <= price * num){
				printf("%d\n", ID);
				f = 1;
			}
		}
	}
	if(!f) printf("NA\n");
	return 0;
}