#include<iostream>
#include<math.h>
using namespace std;
int main(){

  int t=0,y=0,h=0,k,i,n,r;
  double c;
  while(cin>>t>>y>>h){
    if(t==0&&y==0&&h==0)break;
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    if(y<h){
      n=t;
      t=y;
      y=n;
    }
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    c=sqrt((t/2)*(t/2)+(y/2)*(y/2));
    cin>>k;
    for(i=0;i<k;i++){
      cin>>r;
      if(r>c){
	cout<<"OK"<<endl;
      }
      else{
	cout<<"NA"<<endl;
      }
    }
  }
  return 0;
}
      