while True:
	n=int(input())
	if n:
		f=True
		a=[list(map(int,input().split())) for _ in range(n)]
		for i in range(n):
			if a[i][1]*a[i][2]>=1000000:
				print(a[i][0])
				f=False
		if f:
			print("NA")
	else:
		break