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++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#define eps 1e-10
using namespace std;

int main() {
	int a, b, c, n, r;
	while(1){
		cin >> a >> b >> c;
		if(a == 0 && b == 0 && c == 0){
			break;
		}
		cin >> n;
		while(n--){
			cin >> r;
			double x = sqrt(2.0) * r;
			if(x - a + eps > 0 && x - b + eps > 0 || x - b + eps > 0 && x - c + eps > 0 || x - c + eps > 0 && x - a + eps > 0){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  double x,y,t;
  int r;
  int n;
  while(1){
    cin >> x >> y >> t;
    if(x==0 && y==0 && t==0)break;
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> r;
      if(x/2<r && y/2<r && t/2<r){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}

C++: #include <stdio.h>
#include <stdlib.h>

void judge(int x, int y, int z, int r);

int main(void)
{
    int cheese_x, cheese_y, cheese_z;
    scanf("%d", &cheese_x);
    scanf("%d", &cheese_y);
    scanf("%d", &cheese_z);
    int n;
    int cnt;
    scanf("%d", &n);
    for(cnt = 0; cnt < n; cnt++){
        int hole_size;
        scanf("%d", &hole_size);
        judge(cheese_x, cheese_y, cheese_z, hole_size);
    }
    return 0;
}

void judge(int x, int y, int z, int r)
{
    int d_1, d_2, d_3;
    d_1 = (x / 2) * (x / 2) + y * y;
    d_2 = (y / 2) * (y / 2) + z * z;
    d_3 = (z / 2) * (z / 2) + x * x;
    if(d_1 < r || d_2 < r || d_3 < r){
        printf("OK\n");
    } else {
        printf("NA\n");
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

more:
  int a,b,c; cin >> a >> b >> c;
  if (!a && !b && !c) return 0;

  int A = a * a;
  int B = b * b;
  int C = c * c;
  int CHOCKEY2 = min(A+B, min(A+C, B+C));

  int n; cin >> n;
  rep(_, n) {
    int r; cin >> r;
    if (4 * r * r > CHOCKEY2) {
      cout << "OK" << endl;
    } else {
      cout << "NA" << endl;
    }
  }

  goto more;
}

C++: #include <cstdio>
int a,b,c,n,r;
int main(){while(scanf("%d%d%d",&a,&b,&c),a|b|c){a*=a;b*=b;c*=c;scanf("%d",&n);while(n--){scanf("%d",&r);r*=4*r;puts((a+b<r||b+c<r||c+a<r)?"OK":"NA");}}return 0;}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    long long a, b, c, chk;


    while (cin >> a >> b >> c, a || b || c) {
        chk = min(a * a + b * b, min(b * b + c * c, a * a + c * c));

        int n;        
        cin >> n;
        while (n--) {
            long long r;

            cin >> r;
            if ((2 * r) * (2 * r) >= chk)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
        }
    }
    
    return 0;
}

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

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>
#include <math.h>

using namespace std;


int tate,yoko,taka,n;

double naname(int x, int y){
    return sqrt(x*x+y*y);
}

int main(){
    while(cin>>tate>>yoko>>taka){
        if(tate==0&&yoko==0&&taka==0)break;
        double min_naname=min(min(naname(tate, yoko),naname(tate, taka)),naname(yoko,taka));
        
        cin>>n;
        for(int i=0; i<n; i++){
            double iriguchi;
            cin>>iriguchi;
            if(iriguchi*2>min_naname)cout<<"OK"<<endl;
            else cout<<"NA"<<endl;
        }
        
        
    }
}

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 + a * a, c * c + a * a});
    while (n--) {
      int r;
      cin >> r;
      cout << (x < 4 * r * r ? "OK" : "NA") << endl;
    }
  }
}