#include <iostream>
#include <cstdio>
using namespace std;

#define TAR 1000000

int main() {
	int n,num,ch;
	unsigned long t,k;
	while(cin >> n){
		ch = 0;
		while(n){
			scanf("%d %ld %ld",&num,&t,&k);
			if((t!=0)&&(k!=0)){
				if((k > TAR/t)&&(t > TAR/k)){
					cout << num << endl;
					ch++;
				}else if((t >= TAR/k)&&(TAR%k == 0)){
					cout << num << endl;
					ch++;
				}else if((k >= TAR/t)&&(TAR%t == 0)){
					cout << num << endl;
					ch++;
				}
				if(((--n)==0)&&(ch==0)){
					cout << "NA" << endl;
				}
			}
		}
	}
	return 0;
}