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 <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;
		REP(i, n){
			int s;
			cin >> s;
			if (dx[1] < (s * 2)*(s * 2))
				cout << "OK"<<endl;
			else
				cout << "NA" << endl;
		}
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

double d, w, h, n, a, r;

int main(){
	while (cin >> d >> w >> h&&d + w + h){
		if (d > w)swap(d, w);
		if (w > h)swap(w, h);
		cin >> n;
		REP(i, n){
			cin >> r;
			if (r * 2 > sqrt(pow(d, 2) + pow(w, 2)))cout << "OK\n";
			else cout << "NA\n";
		}
	}
}

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

int main() {
  int a,b,c,n,r;
  cin >> a >> b >> c;
  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> r;
    if((a*a + b*b < 4*r*r) || (b*b + c*c < 4*r*r) || (c*c + a*a < 4*r*r)) {
      cout << "OK" << endl;
    }
    else
      cout << "NA" << endl;
  }
}

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

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

int main(){
    int tmp[3],a,b,mini,n;
    for(int i=0;i<3;i++) cin >> tmp[i];
    sort(tmp,tmp+3); a = tmp[0]; b = tmp[1];
    mini = sqrt(a*a+b*b);
    cin >> n;
    while(n--){
        cin >> a;
        cout << ((a*2 > mini)? "OK" : "NA") << endl;
    }
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	LL a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	LL bd=a[1]*a[1]+a[0]*a[0];
	int cnt=0;
	while(cnt<N){
		LL t;
		cin>>t;
		if(t*t*4>bd)res.PB("OK");
		else res.PB("NA");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
 
int main(){
 
    double d,w,h,r,min_dist,dist1,dist2,dist3;
    int n;
 
    while(true){
        scanf("%lf %lf %lf",&d,&w,&h);
        if(d == 0.0 && w == 0.0 && h == 0.0)break;
 
        scanf("%d",&n);
 
        for(int i=0; i < n; i++){
            scanf("%lf",&r);
            dist1 = (sqrt(d*d+w*w))/2.0;
            dist2 = (sqrt(w*w+h*h))/2.0;
            dist3 = (sqrt(d*d+h*h))/2.0;
            min_dist = min(dist1,min(dist2,dist3));
            if(r > min_dist){
                printf("OK\n");
            }else{
                printf("NA\n");
            }
        }
    }
 
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int n, r, d, w, h, x;
	while (1) {
		cin >> d >> w >> h;
		if (d + w + h == 0)
			return 0;
		if (d <= h && w <= h)
			x = d * d + w * w;
		else if (d <= w && h <= w)
			x = d * d + h * h;
		else if (w <= d && h <= d)
			x = w * w + h * h;
		cout << x;
		cin >> n;
		for (int lop = 0; lop < n; lop++) {
			cin >> r;
			if (4*r*r > x)
				cout << "OK\n";
			else
				cout << "NA\n";
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int edge[3];
  while(cin >>edge[0]>>edge[1]>>edge[2],edge[0]||edge[1]||edge[2]){
    int n;
    cin >>n;
    sort(edge,edge+3);
    while(n--){
      int x;
      cin >>x;
      if(edge[0]*edge[0]+edge[1]*edge[1]<x*x*4){cout <<"OK"<<endl;}
      else{cout <<"NA"<<endl;}
    }
  }
  return 0;
}