data_num = int(input())

nice_syatiku = 0

for data_num in range(data_num):

    a,b,c = map(int,input().split())

    Earnings = b * c
    
    if Earnings >= 1000000:
        print(a)
        nice_syatiku += 1

if nice_syatiku == 0:
    print("NA\n")
        
       