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++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <string>
using namespace std;


// f(x) = x
// x ^ 2 + y ^ 2 = r ^ 2
// x ^ 2 + x ^ 2 = r ^ 2
// x ^ 2 = r ^ 2 / 2
// x = r / root(2)

// case height <= r * root(2) && width <= r * root(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(width * width < 2 * r * r){
				cnt++;
			}
			if(height * height < 2 * r * r){
				cnt++;
			}
			if(depth * depth < 2 * r * r){
				cnt++;
			}
			if(2 <= cnt){
				ans = "OK";
			}
			cout << ans << endl;
		}
	}
	return 0;
}

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

int main(){
  int w,h,v;
  while(cin >>w>>h>>v, w+h+v){
    int r = w*w + h*h;
    r = min(r , h*h + v*v);
    r = min(r , v*v + w*w);
    double rr = r/4.0;
    int n;
    cin >> n;
    while(n--){
      int rc; cin >> rc;
      rc*=rc;
      if(rr < rc){
        cout << "OK" << endl;
      } else {
        cout << "NA" << endl;
      }
    }
  }
  return 0;
}

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

using namespace std;

int main(){

    double a, b, c, n, r, minEdge;

    while(cin >> a >> b >> c, a || b || c){

        minEdge = min(min(hypot(a, b), hypot(a, c)), hypot(b, c));

        cin >> n;

        for(int i = 0; i < n; ++i){

            cin >> r;

            if(minEdge < 2 * r){
                cout << "OK" << endl;
            } else {
                cout << "NA" << endl;
            }

        }

    }

}

C++: // 2011/01/14 Tazoe

#include <iostream>
using namespace std;

void ABC_sort(int& A, int& B, int& C)
{
	int tmp[3] = {A, B, C};

	for(int i=0; i<2; i++)
		for(int j=i+1; j<3; j++)
			if(tmp[i]>tmp[j]){
				int swp = tmp[i];
				tmp[i] = tmp[j];
				tmp[j] = swp;
			}

	A = tmp[0];
	B = tmp[1];
	C = tmp[2];
}

int main()
{
	while(true){
		int A, B, C;
		cin >> A >> B >> C;
		if(A==0&&B==0&&C==0)
			break;

		ABC_sort(A, B, C);
		int D = A*A+C*C;

		int n;
		cin >> n;

		int R[10000];
		for(int i=0; i<n; i++)
			cin >> R[i];

		for(int i=0; i<n; i++)
			if(D<4*R[i]*R[i])
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <math.h>
#include <algorithm>


using namespace std;

int main() {
	int d, w, h;
	while (true) {
		cin >> d >> w >> h;
		if (!d && !w && !h)break;
		int min1, min2;
		min1 = min(d, w);
		if (min1 == d)min2 = min(w, h);
		else min2 = (d, h);

		double s = sqrt(min1 * min1 + min2 * min2);

		int n;
		cin >> n;
		for (int i = 0; i < n; i++) {
			int r;
			cin >> r;
			if (s < 2*r) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}

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

int main()
{
	while (1) 
	{
		vector<int>a(3);
		cin >> a[0] >> a[1] >> a[2];
		if (a[0] == 0 && a[1] == 0 && a[2] == 0)break;
		int b;
		cin >> b;
		sort(a.begin(), a.end());
		for (int c = 0; c < b; c++) {
			int d;
			cin >> d;
			if (a[0]*a[0]+a[1]*a[1]<d*d*4)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

C++: #include<stdio.h>

int main(){
  int a,b,c,r,i,n;
  double sa,sb,sc,sr;
  do{
    scanf("%d %d %d",&a,&b,&c);
    if(a==0&&b==0&&c==0) break;
    scanf("%d",&n);
    sa=(double)a/2.0;
    sb=(double)b/2.0;
    sc=(double)c/2.0;
    sa*=sa;
    sb*=sb;
    sc*=sc;
    for(i=0;i<n;i++){
      scanf("%d",&r);
      r=r*r;
      sr=(double)r;
      if(((sa+sb)<sr)||((sb+sc)<sr)||((sc+sa)<sr)){
	printf("OK\n");
      }else{
	printf("NA\n");
      }
    }
  }while(1);
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int d,w,h,r,n,rd,rs;double rw;
	while(cin>>d>>w>>h){
		if(d==0&&w==0&&h==0)break;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r;
		rd=r*2;
		if(d<rd&&w<rd&&h<rd){
			rs=rd*r;
			rw=sqrt((double)rs);
			rw=rw*4;
			if((d+w+h)<rw)cout<<"OK"<<endl;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	double D[3];
	while(cin>>D[0]>>D[1]>>D[2],D[0]||D[1]||D[2]){
		sort(D,D+3);
		double x = D[0], y = D[1];
		double r = sqrt(x*x+y*y);
		int N;
		cin>>N;
		for(int i=0;i<N;i++){
			double R;
			cin>>R;
			if(r<R*2) puts("OK");
			else puts("NA");
		}
	}
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void){
	long int a[3],n;
	long int d;
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	d = a[0]*a[0]+a[1]*a[1];
	cin >> n;
	REP(i,n){
		long int r;

		cin >> r;
		if (4*r*r>d)
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}

	cin >> d >> d >> d;


	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	while(1)
	{
	int a[3]; cin >> a[0] >> a[1] >> a[2] ;
	if(a[0]==0 && a[1]==0 && a[2]==0) break;
	int n ; cin >>  n ;
	sort(a,a+3);
	long sum=a[0]*a[0]+a[1]*a[1];
	while(n--)
	{
		long tmp; cin >> tmp;
		if(4*tmp*tmp<=sum) cout << "NA" << endl;
		else cout << "OK" << endl;
	}
	}
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while (1) {

		vector<long long int>ls(3);
		cin >> ls[0] >> ls[1] >> ls[2];
		sort(ls.begin(), ls.end());
		long long int r = (ls[0] * ls[0] + ls[1] * ls[1]);
		if (!ls[0])break;
		long long int d; cin >> d;
		while (d--) {
			long long int n; cin >> n;
			if (4*n*n<r)cout << "OK" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

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

int main(){
	while(1){
		vector<double> 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((r*r)+(r*r));
			//cout<<r<<" "<<x[1]<<endl;
			if(r>x[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}