There is data on sales of your company. Your task is to write a program which identifies good workers.  The program should read a list of data where each item includes the employee ID _i_ , the amount of sales _q_ and the corresponding unit price _p_. Then, the program should print IDs of employees whose total sales proceeds (i.e. sum of p × q) is greater than or equal to 1,000,000 in the order of inputting. If there is no such employees, the program should print "NA". You can suppose that _n_ < 4000, and each employee has an unique ID. The unit price _p_ is less than or equal to 1,000,000 and the amount of sales _q_ is less than or equal to 100,000.
num = int(input())
if not num:
    exit()
data = [[int(el) for el in input().split(' ')] for _ in range(num)]
result = [print(i) for i,j,k in data if j*k >= 1e6]
if not result:
    print('NA')
from collections import OrderedDict
while True:
    num = int(input())
    if not num: break
    result = OrderedDict()
    for _ in range(num):
        x, y, z = [int(el) for el in input().split(' ')]
        if x in result:
            result[x] += y*z
        else:
            result[x] = y*z
    res = [print(k) for k,v in result.items() if v >= 1e6]
    if not res: print('NA')