#include <iostream>
#include <vector>
#include <utility>

class employee {
public:
	int id;
	int p, q;
	bool more_than_million() {
		return (p * q >= 1000000);
	}
};

int n;
std::vector<employee> data;

void init()
{
	n = 0;
	data.clear();
}

bool get_input()
{
	init();
	std::cin >> n;
	if (n == 0) {
		return false;
	}
	for (int i = 0; i < n; i++) {
		employee tmp;
		std::cin >> tmp.id >> tmp.p >> tmp.q;
		data.push_back(tmp);
	}
	return true;
}

void solve()
{
    std::vector<employee>::iterator i = data.begin();
    std::vector<int> top_salers;
    while(i != data.end()){
       if((*i).more_than_million()){
    	   top_salers.push_back((*i).id);
        }
       i++;
     }
    if (top_salers.empty()) {
    	std::cout << "NA" << std::endl;
    } else {
    	for (std::vector<int>::iterator j = top_salers.begin(); j != top_salers.end(); j++) {
    		std::cout << (*j) << std::endl;
    	}
    }
}

int main()
{
	while (get_input()) {
		solve();
	}
	return 0;
}