#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;
typedef pair<int, int> P;

int main()
{
    int x, y, z, n, buf, r;
    double dx, dy, rsq;
    while(1){
        cin >> x >> y >> z;
        if(x == 0) break;
        cin >> n;
        
        if(x > y){
            buf = x;
            x = y; 
            y = buf;
        }
        if(y > z){
            buf = y;
            y = z;
            z = buf;
        }
        if(x > y){
            buf = x;
            x = y;
            y = buf;
        }
        
        dx = x;
        dy = y;
        
        rsq = (dx/2)*(dx/2) + (dy/2)*(dy/2);
        
        for (int i=0; i<n; i++) {
            cin >> r;
            if(r*r > rsq) cout << "OK";
            else cout << "NA";
            cout << endl;
        }
    }
    return 0;
}