#include <stdio.h>

int member[4010][3] ;

int main ( )
{
	int n ; 
	bool na = false ;
	while ( scanf ( "%d" , &n ) == 1 && n ){
		na = false ;
		for ( int i = 0 ; i < n ; i++ ){
			scanf ( "%d %d %d" , &member[i][0] , &member[i][1] , &member[i][2] ) ;
			int tmp = member[i][1] * member[i][2] ;
			if ( tmp > 1000000 ){
				printf ( "%d\n" , member[i][0] ) ;
				na = true ;
			}
		}
		if ( ! na ){
			printf ( "NA\n" ) ;
		}
	}
	return 0 ;
} 