list = []

while (True):
    n = int(input())
    if (n == 0):
        break

    isNA = True

    for i in range(n):
        ds = input().split()
        e = ds[0]
        p = int(ds[1])
        q = int(ds[2])

        sales = p * q

        if (1000000 <= sales):
            list.append(e)
            isNA = False

    if isNA:
        list.append("NA")

for l in list:
    print("%s" % l)