while(True):
    x = int(raw_input())
    if x==0 : break
    flag=0

    for i in range(x):
        list = [int(y) for y in (raw_input()).split()]
        if(list[1]*list[2]>=1000000):
            print list[0]
            flag=1
    if flag==0:
        print 'NA'