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 <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;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

int x,y,z,n;

int sq(int a){return a*a;}

void solve()
{
	int a[3] = {x,y,z};
	sort(a,a+3);
	int r2 = sq(a[0]) + sq(a[1]);
	cin>>n;
	for (int i = 0; i < n; i++){
		int b; cin>>b;
		puts((r2 <= 4*b*b) ? "NA" : "OK");
	}
}

int main(){
	while(cin>>x>>y>>z,(x||y||z)){
		solve();
	}

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int number;
	cin>>number;
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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int d[3];
	while (cin >> d[0] >> d[1] >> d[2], d[0] | d[1] | d[2] ){
		vector<int> dx(3);
		REP(i, 3){
			dx[i] = d[i] * d[i] + d[(i + 1) % 3] * d[(i + 1) % 3];
		}
		SORT(dx);
		int n;
		cin >> n;
		vector<int> s(n);
		REP(i, n){
			cin >> s[i];
		}
		REP(i, n){
			if (dx[1] < (s[i] * 2))
				cout << "OK"<<endl;
			else
				cout << "NA" << endl;
		}
	}
}

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

int main(){
	while(1){
		vector<int> x(3);
		cin>>x[0]>>x[1]>>x[2];
		if(x[0]==0&&x[1]==0&&x[2]==0)break;
		int n;
		cin>>n;
		sort(x.begin(),x.end());
		for(int i=0;i<n;i++){
			double r;
			cin>>r;
			r=sqrt(2)*r;
			if(r>x[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef pair<string, int>P;

int main() {
	double d, w, h;
	while (cin >> d >> w >> h, d) {
		double n; cin >> n;
		rep(i, n) {
			int r; cin >> r;
			if (r*2 > sqrt(d*d + w*w) || r*2 > sqrt(d*d + h*h) || r*2 > sqrt(w*w + h*h))
				puts("OK");
			else puts("NA");
		}
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int a[3]; cin >> a[0] >> a[1] >> a[2] && a[0];) {
		int n; cin >> n;
		sort(a, a + 3);
		rep(i, 0, n) {
			int r; cin >> r;
			if (r*r * 4 > a[0] * a[0] + a[1] * a[1])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return 0;
}

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

#define S(X) ((X)*(X))

using namespace std;

int main(){
  for(int l[3];cin>>l[0]>>l[1]>>l[2],l[0]|l[1]|l[2];){
    sort(l,l+3);
    int n;
    cin>>n;
    while(n--){
      int r;
      cin>>r;
      cout<<((S(l[0])+S(l[1])<S(2*r))?"OK":"NA")<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e4;

int main()
{
	lld d,w,h,n;
	double r[MAXN] = {0};

	cin >> d >> w >> h;
	if (d == 0 && w == 0 && h == 0)
	{
		return 0;
	}

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

	double di[3] = {sqrt(d*d + w*w), sqrt(w*w + h*h), sqrt(h*h + d*d)};

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			if (2*r[i] > di[j])
			{
				cout << "OK" << endl;
				break;
			}

			if (j == 2)
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}