#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;
struct P{
	int id;
	int tanka;
	int kosuu;
};

int main()
{
	int n;

	while (cin >> n && n ){
		vector<P> data (n );
		rep (i, n ){
			cin >> data[i].id >> data[i].tanka >> data[i].kosuu;
		} // end rep
		bool found = false;
		rep (i, n ){
			ll total = (ll)data[i].tanka*data[i].kosuu;
			if (total >= 1000000LL ){
				cout << data[i].id << endl;
				if (!found )
					found = true;
			} // end if
		} // end rep
		if (!found ){
			cout << "NA" << endl;
		} // end if
	} // end loop
		
	return 0;
}