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>

using namespace std;


int main(){

  int a,b,c,r,qua;

  while(1){
    cin >> a >> b >> c;

    if(a == 0) break;

    cin >> qua;

    for(int i = 0; i < qua; i++){
      cin >> r;

      if(a < 2*r && b < 2*r && c < 2*r) cout << "OK"<<endl;
      else cout << "NA"<<endl;

    }


  }

  return 0;
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

int main()
{
	long long int a[3];
	while (1)
	{
		for (size_t i = 0; i < 3; i++)
		{
			cin >> a[i];
		}
		if (!a[0])break;
		sort(a, a + 3);
		a[2] = a[0] * a[0] + a[1] * a[1];
		int N;
		cin >> N;
		long long int x;
		for (size_t i = 0; i < N; i++)
		{
			cin >> x;
			x *= 2;
			if (x*x>a[2])
			{
				cout << "OK" << endl;
			} else
			{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

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

int main() {
	int cheese[3];
	while (cin >> cheese[0] >> cheese[1] >> cheese[2]) {
		if (cheese[0] == 0 && cheese[1] == 0 && cheese[2] == 0) {
			break;
		}
		sort(cheese,cheese + 3);
		int min_diagonal = cheese[0]*cheese[0] + cheese[1]*cheese[1];
		int n;
		cin >> n;
		while (n--) {
			int r;
			cin >> r;
			cout << (min_diagonal < 4*r*r ? "OK" : "NA") << endl;
		}
	}
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
long a,b,c,n,x,i;
while(cin>>a){
cin>>b>>c>>n;
if(a==0)break;
if(a>=b&&a>=c)x=b*b+c*c;
else if(b>=a&&b>=c)x=a*a+c*c;
else x=a*a+b*b;
for(i=0;i<n;i++){
cin>>a;
if(a*a*4>x)cout<<"OK"<<endl;
else cout<<"NA"<<endl;
}
}
return 0;
}

C++: #include <iostream>

using namespace std;
/** Problem0107 : Carry a Cheese **/
int main()
{
	int x, y, z, r, n, size;
	
	while (1) {
		cin >> x >> y >> z;
		if (x == 0 && y == 0 && z==0)
			break;
	
		cout << size << endl;
		cin >> n;
		for (int i=0; i<n; i++) {
			cin >> r;
			if (2*r*2*r > x*x+y*y || 4*r*r > x*x+z*z || 4*r*r > y*y+z*z)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    if(z < x)
        swap(z, x);
    if(z < y)
        swap(z, y);

    int n;
    cin >> n;

    while(--n >= 0){
        int r;
        cin >> r;
        if(4*r*r - x*x - y*y > 0)
            cout << "OK" << endl;
        else
            cout << "NA" << endl;
    }
}

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

int main() {
    int A, B, C;
    while (cin >> A >> B >> C && (A || B || C)) {
        int t = 1e9;
        t = min(t, A * A + B * B);
        t = min(t, B * B + C * C);
        t = min(t, C * C + A * A);
        cout << t << endl;
        int n, R;
        cin >> n;
        for (int i=0; i<n; ++i) {
            cin >> R;
            if (t < 4 * R * R) {
                cout << "OK" << endl;
            } else {
                cout << "NA" << endl;
            }
        }
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>

using namespace std;

int main() {
	
	int a, b, c;
	
	while( cin >> a >> b >> c) {
		
		if( a == b && b == c && c == 0)
			break;
			
		double d[4] = {};
		
		d[0] = sqrt(a * a + b * b) / 2;
		d[1] = sqrt(a * a + c * c) / 2;
		d[2] = sqrt(b * b + c * c) / 2;
		
		d[4] = min(d[0], min(d[1], d[2]));
		
		int n;
		cin >> n;
		
		for(int i=0;i<n;i++) {
			
			int r;
			cin >> r;
			
			if(r > d[4])
				cout << "OK\n";
			
			else
				cout << "NA\n";
			
		}
		
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <math.h>
#define D(x) (x*x)
using namespace std;
int main(){
	while(1){
		int l[4],r,n;
		double m;
		for(int i=0; i<3; i++) cin >> l[i];
		if(l[0]+l[1]+l[2]==0) break;
		sort(l, l+3);
		m = sqrt(D(l[0])+D(l[1]))/2;
		cin >> n;
		while(n--){
			cin >> r;
			if(r>m) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return(0);
}

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;

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

	return 0;
}

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


void doIt(){
	int a,b,c,n,i;
	cin >> a >> b >> c;
	while(a + b + c > 0){
		cin >> n;
		int r[n];
		//cout << sqrt(a*a + b*b) / 2 << ", " << sqrt(b*b + c*c) / 2 << "," << sqrt(a*a + c*c) / 2;
		for(i = 0; i < n; i++){
			std::cin >> r[i];
			//斜辺を計算する
			bool bOK = false;
			if(sqrt(a*a + b*b) / 2 < r[i] || sqrt(b*b + c*c) / 2 < r[i] || sqrt(c*c + a*a) / 2 < r[i]){
				bOK = true;
			}
			if(bOK){
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}
		cin >> a >> b >> c;
	}
}

int main(){
doIt();
}