#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	for(int a,b,c,n,r;scanf("%d%d%d",&a,&b,&c),a|b|c;)
		for(
			scanf("%d",&n);
			n--;
			puts(
				(2*r<
					std::min(
						std::min(
							sqrt(a*a+b*b),
							sqrt(b*b+c*c)
						),
						sqrt(c*c+a*a)
					)
				)?
					"OK"
				:
					"NA"
			)
		)scanf("%d",&r);
}