#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

 
int main(){
	int n;
	while(cin>>n,n){
		vector<int> a;
		for (int i = 0; i < n; i++){
			int d,b,c; cin>>d>>b>>c;
			if(b*c >= 1000000) a.push_back(d);
		}
		if(a.size() == 0){ puts("NA"); continue; }
		for (int i = 0; i < a.size(); i++)
			cout << a[i] << endl;
	}
    return 0;
}