while True:
    N = int(input())
    if N == 0:
        break
    fla = False
    for n in range(N):
        num, p, q = map(int, input().split())
        if p*q >= 1000000:
            print(num)
            fla = True
    else:
        if not fla:
            print('NA')