#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void) {

	int n, e[1000], p[1000], q[1000];
	int cnt = 0;

	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> e[i] >> p[i] >> q[i];
			if (p[i] * q[i] >= 1000000)
				cout << e[i] << endl;
			else
				cnt++;
		}
		if (cnt == n)
			cout << "NA" << endl;
		cnt = 0;
	}

	return 0;
}