x = 1
while x != 0:
    x = int(input().rstrip())
    frag = 0
    for j in range(x):
        A = input().sprit(" ")
        if int(A[1]) * int(A[2]) >= 1000000:
            print(A[0])
            flag = 1
    if flag == 0:
        print("NA")