while True:
    NA = True
    n = int(raw_input())
    if n == 0: break
    for i in range(n):
        data = raw_input().split()
        if int(data[1]) * int(data[2]) >= 1000000:
            NA = False
            print data[0]
    if NA: print "NA"