while 1:
    n=input()
    if n==0:break
    a=[0]*n
    s=[]
    for i in xrange(n):
        a[i]=map(int,raw_input().split())
    for i in xrange(n):
        if a[i][1]*a[i][2]>=10**6:
            s.append(a[i][0])
        else:
            pass
    if s==[]:
        print("NA")
    else:
        for i in xrange(len(s)):
            print(s[i])