Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		line := strings.Split(stdin.Text(), " ")
		len := []int{}
		for i := 0; i < 3; i++ {
			tmp, _ := strconv.Atoi(line[i])
			len = append(len, tmp)
		}
		if len[0] == 0 && len[1] == 0 && len[2] == 0 {
			break
		}
		sort.Ints(len)
		d2 := len[0]*len[0] + len[1]*len[1]
		stdin.Scan()
		n, _ := strconv.Atoi(stdin.Text())
		for i := 0; i < n; i++ {
			stdin.Scan()
			r, _ := strconv.Atoi(stdin.Text())
			if 4*r*r > d2 {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int tate,yoko,takasa,mn,md;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mn=min(min(tate , yoko) , takasa);
		if(tate>=yoko){
			if(yoko>=takasa) {
			    md=yoko;
			} else if (yoko<takasa) {
				if(tate>=takasa)  md=takasa;
				else if (tate<takasa)  md=tate;
			}
			
		} else if (tate<yoko){
			if (tate>=takasa){
				md=tate;
			} else if(tate<takasa){
				if(yoko>=takasa) md=takasa;
				else if(yoko<takasa) md=yoko;
			}
		}
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mn*mn+md*md) ? "OK" : "NA") << endl;
			delete [] r;
		}
	}
	return 0; 
}

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

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

using namespace std;

int main() {
  int a, b, c;
  while (cin >> a >> b >> c, a) {
    double cheese = min({a * a + b * b, a * a + c * c, b * b + c * c});
    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
      int r;
      cin >> r;
      cout << ((4 * r * r <= cheese) ? "NA" : "OK") << endl;
    }
  }
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <string>
#define sqr(x) (x) * (x)
using namespace std;


// (height / 2) ^ 2 + (width / 2) ^ 2 <= r ^ 2

int main() {
	int height, width, depth, n, r;
	while(true){
		cin >> height >> width >> depth;
		if(height == 0 && width == 0 && depth == 0){
			break;
		}
		cin >> n;
		for(int i = 0;i < n;i++){
			cin >> r;
			string ans = "NA";
			int cnt = 0;
			if(sqr(height / 2.0) + sqr(width / 2.0) < r * r || sqr(height / 2.0) + sqr(depth / 2.0) < r * r || sqr(width / 2.0) + sqr(depth / 2.0) < r * r){
				ans = "OK";
			}
			cout << ans << 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 + a * a, c * c + a * a});
    while (n--) {
      int r;
      cin >> r;
      cout << (x <= 4 * r * r ? "OK" : "NA") << endl;
    }
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int depth, width, height;
double a, b;

bool judge(int rad) {
    return(rad > sqrt(a+b));
}

int main(void) {
    while(cin >> depth >> width >> height, depth|(width|height)) {
        a = (width*width / 4.0);
        b = (height*height / 4.0);
        int num; cin >> num;
        for(int r = 0; r < num; r++) {
            int input; cin >> input;
            puts((judge(input)) ? "OK":"NA");
        }
    }
    return(0);
}

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

int main()
{
	int x, y, z, ins, i;
	int *input;
	cin >> x >> y >> z;
	cin >> ins;
	input = new int[ins]();
	for(i = 0; i<ins; i++)
		cin >> input[i];
	for(i = 0; i<ins; i++)
	{
		if(input[i]*2 < sqrt(x*x+y*y))
		{
			cout << "NA" << endl;
		}
		else
			cout << "OK" << endl;
	}
}

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

using namespace std;

int main(){
  while(1){
    int a[3];
    scanf("%d%d%d", a, a+1, a+2);
    if(a[0]==0&a[1]==0&a[2]==0) break;

    sort(a, a+3);

    int t = (a[0]*a[0]+a[1]*a[1]);

    int n;
    scanf("%d", &n);

    for(int i=0;i<n;i++){
      int k;
      scanf("%d", &k);
      printf("%s\n", (4*k*k > t)? "OK":"NA");
    }
  }
}

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return 0;
	}
#endif
	/*****変数置き場*****/
	int c_v,c_h,c_w;
	int n;
	int e_r;
	/*****処理部*****/
	while(1){
		cin >> c_v >> c_w >> c_h;
		if(c_v == 0 && c_w == 0 && c_h == 0)	break;
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> e_r;
			if((c_v*c_v + c_w*c_w) < (e_r*2 * e_r*2)){
				//cout << c_v*c_v + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else if((c_v*c_v + c_h*c_h) < (e_r*2 * e_r*2)){
				//cout << c_v*c_v + c_h*c_h << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else if((c_h*c_h + c_w*c_w) < (e_r*2 * e_r*2)){
				//cout << c_h*c_h + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else{
				//cout << c_v*c_v + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "NA" << endl;
			}
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,tate,yoko,high,hole,large;
  while(1){
    cin >> tate >> yoko >> high;
    if(tate==0 && yoko==0 && high==0){
      break;
    }
    cin >> n;
    if(tate>=yoko && tate>=high){
      large=tate;
    }
    else if(yoko>=tate && yoko>=high){
      large=yoko;
    }
    else if(high>=tate && high>=yoko){
      large=high;
    }
    cout << large << endl;
    for(int i=0;i<n;i++){
      cin >> hole;
      hole=hole*2;
      if(hole>large){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
  return (0);
}

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

int main(){
	int h,w,d,n,a;
	while(cin >> h >> w >> d,h){
		cin >> n;
		for(int i = 0;i < n;++i){
			cin >> a;
			if(a >= h || a >= w || a >= d){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}