#include<iostream>
using namespace std;
int main(){
  while(1){
    int a,b,c,d[10010],n,i,j;
    cin >> a >> b >> c;
    if(a == 0 && b== 0 && c == 0){
      break;
    }
    cin >> n;
    for(i=0;i<n;i++){
      cin >> d[i];
      if(d[i]*2 > b && d[i]*2 > c && d[i]*2 > a){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}