#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

int main(void){
	int N;
	int i,p,q;
	while(cin >> N){
		int check = 0;
		if(!N) break;
		for(int i=0; i<N; ++i){
			cin >> i >> p >> q;
			if(p*q >= 1000000) check = 1, cout << i << endl;
		}
		if(check = 0) cout << "NA" << endl;
	}

	return 0;
}