#include<stdio.h>
int i,j,k,temp;

int bouble_sort(int area[5]){	//ou\[gbox_area[2]ªÅ¬l
	
	temp=0;
	for(i=0;i<3-1;i++){						
		for(j=3-1;i<j;j--){
			if(area[j-1]>area[j]){
				temp=area[j];
				area[j]=area[j-1];
				area[j-1]=temp;
			}
		}
	}
	return 0;
}

int main(void){

	
	int hole[10000]={0},n,height,width,depth,box_area[5];
	int hantei[10000]={0};
	double hole_area[10000];

	
	height=0;
	width=0;
	depth=0;
	
	
	scanf("%d %d %d\n",&height,&width,&depth);
	scanf("%d",&n);

	for(i=0;i<n+1;i++){
		scanf("%d",&hole[i]);
		if(scanf("%d %d %d",&hole[i],&hole[i],&hole[i])){
			break;
		}
	}

	for(i=0;i<n;i++){
		hole_area[i]=(double)(hole[i]*hole[i]*3.14);
	}

	box_area[0]=height*width;	//¼ûÌÌ3ÊÌ»ê¼êÌÊÏ
	box_area[1]=height*depth;
	box_area[2]=width*depth;

	bouble_sort(box_area);

	/*for(i=0;i<5;i++){
		printf("area_box[%d]=%d\n",i,box_area[i]);
	}*/

	for(i=0;i<n;i++){
		if(hole_area[i]>box_area[2]){
			hantei[i]=1;
		}
		else{
			hantei[i]=0;
		}
	}

	for(i=0;i<n;i++){
		if(hantei[i]==1){
			printf("OK\n");
			}
		else{
			printf("NA\n");	
		}
	}
	
	return 0;
}