#include<stdio.h>
int main(void)
{
	int t,y,ts;
	int n;
	int h[10000],m;
	int i;
	scanf("%d %d %d",&t,&y,&ts);
		while(!(t==0 && y==0 && ts==0)){
			scanf("%d",&n);
				for(i=0;i<n;i++){
					scanf("%d",&h[i]);
					m=2*h[i];
					if((m>y) || (m>ts)){
						printf("OK\n");
					}
					else if((m>y) || (m>t)){
						printf("OK\n");
					}
					else if((m<=y) || (m<=ts)){
						printf("NA\n");
					}
					else if((m<=y) || (m<=t)){
						printf("NA\n");
					}
				}
				scanf("%d %d %d",&t,&y,&ts);
			}
		return 0;
}