#include <stdio.h>

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