


while True:
    n=int(input())
    if n==0:
        break
    else:
        for i in range(n):
            k=0
            l=map(int, input().split())
            if l[1]*l[2]>=1000000:
                print(l[0])
                k+=1
        if k==0:
            print("NA")