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 <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)*(s[i] * 2))
				cout << "OK"<<endl;
			else
				cout << "NA" << endl;
		}
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	vint v(3);
	while(cin >> v[0] >> v[1] >> v[2] && (v[0] || v[1] || v[2]))
	{
		sort(ALL(v));

		int n;
		cin >> n;
		rep(i, n)
		{
			int r;
			cin >> r;

			cout << (4 * r * r <= v[0] * v[0] + v[1] * v[1] ? "NA" : "OK" ) << endl;
		}
	}
}

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

int main(){
  int l1, l2, l3;
  while(true){
    cin>>l1>>l2>>l3;
    int l11=l1*l1, l22=l2*l2, l33=l3*l3;
    if(l1==0 && l2==0 && l3==0)break;
    int min_l=min(min(l11+l22, l22+l33), l33+l11);
    int n;
    cin>>n;
    while(n--){
      int r;
      cin>>r;
      if(min_l<r*r*4)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int h[3],n,r;
int tp;

	while(cin >> h[0] >> h[1] >> h[2] ){
		if(h[0]==0 && h[1]==0 && h[2]==0 || cin.eof()) break;
		sort(h,h+3);
		int r2 = h[0]*h[0]+h[1]*h[1];
		cin >> n;
		rep(i,n){
			cin >> r;
			cout << (4*r*r>r2? "OK": "NA") << endl;
		}
	}
	return 0;
}

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

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

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

int main(){
	while(1){
		int a[3], n;
		for(int i=0; i<3; ++i) scanf(" %d", &a[i]);
		sort(a, a+3);
		if(a[2]==0) break;
		
		scanf(" %d", &n);
		for(int i=0; i<n; ++i){
			int r;
			scanf(" %d", &r);
	
			if(a[0]*a[0]+a[1]*a[1]<4*r*r) printf("OK\n");
			else printf("NA\n");
		}	
	}

	return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		ll d=in(),w=in(),h=in();
		if(!d && !w && !h) break;
		ll minA=min({d*d+w*w,w*w+h*h,h*h+d*d});
		int N=in();
		LOOP(N){
			int R=in();
			if(4*R*R>minA) out("OK");
			else out("NA");
		}
	}
	return 0;
}

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

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	for(;;){
		int length[3];
		rep(i, 3)
			scanf("%d", &length[i]);
		if(length[0]+length[1]+length[2] == 0)
			break;
		sort(length, length+3);
		int l = length[0]*length[0] + length[1]*length[1];

		int n;
		scanf("%d", &n);
		rep(i, n){
			int r;
			scanf("%d", &r);
			puts(r*r*4>l ? "OK" : "NA");
		}
	}
	return 0;
}