#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>

using namespace std;

typedef long long ll;

int n, id, p, q;
ll amount;

const ll MAX = 1000000;

int main(void) {
    while(~scanf("%d", &n)) {
        if(n == 0) break;
        vector<int> ans;
        for(int i = 0; i < n; i++) {
            scanf("%d%d%d", &id, &p, &q);
            amount = p*q;
            if(amount >= MAX) {
                ans.push_back(id);
            }
        }
        if(ans.empty()) {
            printf("NA\n");
        } else {
            for(int i = 0; i < (int) ans.size(); i++) {
                printf("%d\n", ans[i]);
            }
        }
    }
    return 0;
}