n = int(raw_input())
while n != 0:
    pass_flag = 0
    for x in range(0, n):
        data = raw_input()
        data_list = data.split(' ')
        if int(data_list[1]) * int(data_list[2]) >= 1000000:
            pass_flag = 1
            print data_list[0]
    if pass_flag == 0:
        print 'NA'
    n = int(raw_input())