Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
int main(){
    vl a(3); vector<string>ans;
    int n; ll r;
    while(cin>>a[0]>>a[1]>>a[2],a[0]+a[1]+a[2]){
        cin>>n;
        rep(i,n){
            cin>>r;
            sort(all(a));
            ll temp=a[0]*a[0]+a[1]*a[1];
            if((r*2)*(r*2)>temp)ans.push_back("OK");
            else ans.push_back("NA");
        }
    }
    rep(i,ans.size())cout<<ans[i]<<endl;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14
int main(){
	int en;
	int i,y,k;
	int n;
	while(cin >> i >> y >> k , i * y * k){
		int min = sqrt (i * i + y * y);
		if(min > sqrt (k * k + y * y) ) min = sqrt (k * k + y * y);
		if(min > sqrt (i * i + k * k) ) min = sqrt (i * i + k * k);
		cout<<min<<endl;
		cin>>n;
		for(int i = 0 ; i < n ; i++){
			int m;
			cin>>m;
			cout<<2*m<<" "<<min<<endl;
			 if(min<m*2)cout << "OK" << endl;
			 else cout << "NA" << endl; 
		}
		
	}

}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
int r[100];
int n=0;

while(true){
	int temp;
	cin>>temp;
	if(n>=2&&temp==0&&r[n-1]==0&&r[n-2]==0){
		break;
	}
	else{
		r[n]=temp;
		n=n++;
	}
}
	int rec1,rec2,rec3;
	rec1=a*a+b*b;
	rec2=a*a+c*c;
	rec3=b*b+c*c;


	for (int i=0;i<(n-2);i++){
	 if (4*r[i]*r[i]>rec1||4*r[i]*r[i]>rec2||4*r[i]*r[i]>rec3){
		 cout<<"OK"<<endl;
	 }
	 else{
		 cout<<"NA"<<endl;
	 }
	}
return 0;

}

C++: #include <cstdio>
#include <cmath>
#include <iostream>

double CalcGr(int x,int  y);

class Cheese{
public:
	int x;
	int y;
	int z;
	double gr[3];
	Cheese(){
		scanf("%d %d %d", &x, &y, &z);
		gr[0] = CalcGr(x, z);
		gr[1] = CalcGr(x, y);
		gr[2] = CalcGr(y, z);
	}
};

int main(){
	Cheese c;
	
	int n;
	scanf("%d", &n);

	int r;
	for (int i = 0; i < n; i++){
		scanf("%d", &r);
		if (c.gr[0] > r || c.gr[1] > r || c.gr[2] > r){
			printf("OK\n");
		}
		else{
			printf("NA\n");
		}
	}
}

double CalcGr(int x, int y){
	return sqrt(x*x + y*y) / 2;
}

C++: #include<stdio.h>
#include<math.h>
#define M(a,b) a<b?a:b
int main(){
	for(int a,b,c,n,r;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2*r>M(M(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

C++: #include<stdio.h>
#include<algorithm>
int main(void)
{
	int i,n,x,y,z,r,m;
	while(scanf("%d%d%d",&x,&y,&z), x)
	{
		m = std::min(x*x+y*y, std::min(y*y+z*z,z*z+x*x));

		scanf("%d",&n);
		for(i = 0; i < n; ++i)
		{
			scanf("%d",&r);
			puts( m<4*r*r ? "OK" : "NA" );
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

double fr(double a, double b, double c){
    if( a > b ) swap(a, b);
    if( b > c ) swap(b, c);
    return sqrt( a*a + b*b );
}

int main(){
    double a, b, c;
    while( cin >> a >> b >> c, a||b||c ){
        double r = fr(a, b, c);
        int n;
        cin >> n;
        while( n-- > 0 ){
            double rr;
            cin >> rr;
            if( 2*rr > r ){
                cout << "OK" << endl;
            }else{
                cout << "NA" << endl;
            }
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void){
	long int a[3],n;
	long double d;
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	d = sqrt((double)a[0]*a[0]+(double)a[1]*a[1])/2;
	cin >> n;
	REP(i,n){
		long int r;
		cin >> r;
		if (r>d)
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}

	cin >> d >> d >> d;


	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){

  int a,b,c,n,r[10000];
  double d1,d2,d3,e;
   
  while(1){
    
    cin >>a>>b>>c;
    
    if( a == 0 && b == 0 && c == 0 )break;
    
    d1=sqrt(a*a+b*b);
    d2=sqrt(b*b+c*c);
    d3=sqrt(a*a+c*c);
    
    cin >>n;

    for(int i=0 ; i < n ; i++){
      cin >>r[i];
    }
    
    for(int i=0 ; i < n ; i++){
      
      if( a == 0 ){

	if( b < 2*r[i] || c < 2*r[i]){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else if( b == 0 ){
	
	if( a < 2*r[i] || c < 2*r[i]){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else if( c == 0 ){
	
	if( b < 2*r[i] || a < 2*r[i]){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else{
	
	e=2*sqrt(2*r[i]*r[i]);
	
	if( d1 < 2*r[i] ){
	  
	  if( a+b < e ){
	    cout <<"OK"<<endl;
	  }else{
	    cout <<"NA"<<endl;
	  }
	  
	}else if( d2 < 2*r[i] ){
	  
	  if( b+c < e ){
	    cout <<"OK"<<endl;
	  }else{
	    cout <<"NA"<<endl;
	  }
	  
	}else if( d3 < 2*r[i] ){
	  
	  if( a+c < e ){
	    cout <<"OK"<<endl;
	  }else{
	    cout <<"NA"<<endl;
	  }
	  
	}else{
	  cout <<"NA"<<endl;
	}
	
      }
      
    }
    
  }
  return 0;
  
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b, c;
  while (cin >> a >> b >> c, a) {
    int n;
    cin >> n;
    int x = min({a * a + b * b, b * b + c * c, c * c + a * a});
    while (n--) {
      int r;
      cin >> r;
      cout << (x < 4 * r * r ? "OK" : "NA") << endl;
    }
  }
}