#include <iostream>

int main()
{
    bool loop = true;

    while (loop) {
        int dataset_num;
        itn count = 0;
        std::cin >> dataset_num;

        if (dataset_num == 0) {
            loop = false;
            break;
        }

        for (int i = 0; i < dataset_num; i++) {
            int officer_num;
            int price;
            int figure;
            std::cin >> officer_num;
            std::cin >> price;
            std::cin >> figure;

            if (price * figure >= 1000000) {
                std::cout << officer_num;
                count +=1;
            }
        }
        if (count == 0) {
            std::cout << "NA" << std::endl;
        }
    }

    return 0;
}