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 <cstdio>
#include <cmath>
#include <iostream>

double CalcGr(int x,int  y);

class Cheese{
private:
	int x;
	int y;
	int z;
public:
	double gr[3];
	Cheese(){
//		scanf("%d %d %d", &x, &y, &z);
		std::cin >> x >> y >> z;
		gr[0] = CalcGr(x, z);
		gr[1] = CalcGr(x, y);
		gr[2] = CalcGr(y, z);
	}
};

int main(){
	Cheese c;
	
	int n;
//	scanf("%d", &n);
	std::cin >> n;

	int r;
	for (int i = 0; i < n; i++){
//		scanf("%d", &r);
		std::cin >> r;
		if (c.gr[0] < r || c.gr[1] < r || c.gr[2] < r){
			printf("OK\n");
		}
		else{
			printf("NA\n");
		}
	}

	return 0;
}

double CalcGr(int x, int y){
	return sqrt((double)(x*x + y*y)) / 2;
}

C++: 
#include<iostream>
using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;

int n;
while(1){
cin >> w >> h >> d;
if(w+h+d==0) break;
cin >> n;
while(n--){
cin >> r;
s=r*r*pi;
if(w*h<s||h*d<s||d*w<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define POW(u) ((u)*(u))
signed main(void){
	ios::sync_with_stdio(false);
	int a,b,c,n,x;
	while(cin>>a>>b>>c&&(a|b|c)){
		cin>>n;
		/*
		if(a>c)	swap(a,c);
		if(b>c)	swap(b,c);
		*/
		int v[3];
		v[0]=a,v[1]=b,v[2]=c;;
		sort(v,v+3);
		a=v[0],b=v[1];
		double MIN=POW((double)a/2.0)+POW((double)b/2.0);
		for(int i=1;i<=n;i++){
			cin>>x;
			if(POW(x)>MIN)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
//#include <map>
#include <iomanip>
#include <vector>

using namespace std;



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

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
#include<vector>

double getHypotenuse( double a , double b )
{
	return sqrt( pow(a , 2) + pow(b , 2) );
}

double getMin( double a , double b , double c )
{
	double min = a;
	if( b < min ){
		min = b;
	}
	if( c < min ){
		min = c;
	}
	return min;
}

int main(void)
{
	int x, y, z;

	while(1){
		std::cin >> x >> y >> z;
		if( x == 0 && y == 0 && z == 0 ){
			break;
		}
		double hypoXY = getHypotenuse( x , y );
		double hypoYZ = getHypotenuse( y , z );
		double hypoZX = getHypotenuse( z , x );

		double hypoMin = getMin( hypoXY , hypoYZ , hypoZX );

		int n;
		std::cin >> n;
		for( int i = 0 ; i < n ; i++ ){
			int radius;
			std::cin >> radius;
			std::cout << (hypoMin < 2 * radius ? "OK":"NA") << std::endl;
		}
	}

	return 0;
}

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

int main()
{
	int temp,c,i,f;
	double r,x,y,z;
	cin>>x>>y>>z;

	if(x>y){
		temp=x;
		x=y;
		y=temp;
	}
	if(y>z){
		temp=y;
		y=z;
		z=temp;
	}

	r=sqrt(pow(x/2,2)+pow(y/2,2));

	cout<<r;

	cin>>c;
	for(i=0;i<c;i++){
		cin>>f;
		if(r<=f)
			cout<<"OK\n";
		else cout<<"NA\n";
	}
}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> x;
  size.insert(0, x);
  std::cin >> x;
  size.insert(1, x);
  std::cin >> x;
  size.insert(2, x);
  size.sort(size.begin(), size.end());
  
  while(d!=0 && w!=0 && h!=0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std;;cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

#define MP make_pair<int,int>

int main(){
  while(true){
    int a,b,c;
    cin>>a>>b>>c;
    if(!a)break;
    if(a>b)swap(a,b);
    if(b>c)swap(b,c);
    int x = sqrt(a*a+b*b)/2+1;
    int n;
    cin>>n;
    while(n--){
      int r;
      cin>>r;
      if(r>=x)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

int main() {
	int a, b, c, n;
	while (cin >> a >> b >> c, a || b || c) {
		cin >> n;
		int min1 = min(a, b), min2 = min(max(a, b), c);
		double d = hypot(min1, min2) / 2.0;
		cout << d << endl;
		REP(i, n) {
			double r;
			scanf("%lf", &r);
			if (r - d > EPS) puts("OK");
			else puts("NA");
		}
	}
	return 0;
}

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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double PI = acos(-1.0), EPS = 1e-10;

inline int POW(int x) {
	return x * x;
}

int main() {
	for(int h, w, d; cin >> h >> w >> d, h || w || d;) {
		int a[] = {h, w, d};
		sort(a, a + 3);
		double len = sqrt(POW(a[0]) + POW(a[1]));
		
		int N; cin >> N;
		for(int i = 0; i < N; i++) {
			int L = 0; cin >> L;

			if (len < 2 * L - EPS) {
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}