#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a, b, c, n, r, p;
  while(true){
    cin >> a >> b >> c;
    if(a==0 && b==0 && c==0)
      break;
    p = max(a, b);
    p = max(p, c);
    cin >> n;
    while(n--){
      cin >> r;
      if(2*r > p)
	cout << "OK\n";
      else
	cout << "NA\n";
    }
  }
  return 0;
}