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