#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int tate,yoko,takasa,mx,mn;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mx=max(max(tate , yoko) , takasa);
		mn=min(min(tate , yoko) , takasa);
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mx*mx+mn*mn) ? "OK" : "NA") << endl;
		}
	}
	return 0; 
}