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

using namespace std;


int main() {

  int h,w,d;
  int n;
  int r;

  double min_r;


  while(cin >> h >> w >> d) {

    if(h==0 && w==0 && d==0) break;

    cin >> n;

    if(sqrt(h*h+w*w)>sqrt(w*w+d*d)) {

      if(sqrt(w*w+d*d)>sqrt(d*d+h*h)) min_r=sqrt(d*d+h*h)/2.0;

      else min_r=sqrt(w*w+d*d)/2.0;

    }

    else {
	
      if(sqrt(h*h+w*w)>sqrt(d*d+h*h)) min_r=sqrt(d*d+h*h)/2.0;

      else min_r=sqrt(h*h+w*w)/2.0;
      
    }

    //cout << min_r << endl;

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

      cin >> r;

      if(min_r<(double)r) cout << "OK" << endl;

      else cout << "NA" << endl;

    }

  }

  return 0;

}

C++: #include<cstdio>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#define LL long long
using namespace std;
int main(void)
{
	LL d,w,h,i,j,k,in,n;
	LL dis1,dis2,dis3,T;

	while(1) {	
		cin>>d>>w>>h;
		if(!d&&!w&&!h) break;
		cin>>n;
		for(i=0;i<n;i++) {
			cin>>in;
			T=(in*2)*(in*2);
			dis1=(w*w)+(h*h);
			dis2=(w*w)+(d*d);
			dis3=(h*h)+(d*d);
			if(dis1<T||dis2<T||dis3<T) cout<<"OK\n";
			else cout<<"NA\n";
		}
	}
}

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

const double eps = 1e-9;

int main() {
    int w,h,l;
    while(cin>>w>>l>>h, w|l|h) {
        int rr = w*w+h*h;
        rr = min(h*h+l*l, rr);
        rr = min(l*l+w*w, rr);
        int n,r;
        cin>>n;
        for(int i=0; i<n; ++i) {
            cin>>r;
            if(r*r*4 > rr) cout<<"OK"<<endl;
            else cout<<"NA"<<endl;
        }
    }
}

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

int main(){
	int x,y,z,n,r;
	float r1,r2,r3;
	while(cin>>x>>y>>z,x|y|z){
		r1 = sqrt(x*x+y*y)/2;
		r2 = sqrt(x*x+z*z)/2;
		r3 = sqrt(y*y+z*z)/2;
		for(cin>>n;n;--n){
			cin>>r;
			if(r>r1 || r>r2 || r>r3)cout<<"OK";
			else cout<<"NA";
			cout<<endl;
		}
	}
	return 0;
}

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

int main(){
	int en;
	int i,y,k;
	int n;
	while(cin >> i >> y >> k , i * y * k){
		int max = sqrt (i * i + y * y);
		if(max < sqrt (k * k + y * y) ) max = sqrt (k * k + y * y);
		if(max < sqrt (i * i + k * k) ) max = sqrt (i * i + k * k);
		cin>>n;
		for(int i = 0 ; i < n ; i++){
			int m;
			cin>>m;
			cout<<2*m<<" "<<max<<endl;
			 if(max<=m*2)cout << "OK" << endl;
			 else cout << "NO" << endl; 
		}
		
	}

}

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

int main()
{
while(1){

    int a,b,c;
    cin>>a>>b>>c;
    if(a==0&&b==0&&c==0)break;
    int d;
    cin>>d;
    for(int e=0;e<d;e++){
    int f;
    cin>>f;

    if(f*2>b&&f*2>c){
            cout<<"OK\n";
    }
    else{
        cout<<"NA\n";
    }

    }
}

}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a[3], n; double b, c;
int main() {
	while (true) {
		cin >> a[0] >> a[1] >> a[2];
		if (!a[0] && !a[1]) { break; }
		sort(a, a + 3);
		b = sqrt(a[0] * a[0] + a[1] * a[1]) / 2;
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> c;
			if (b >= c) { cout << "NA" << endl; }
			else { cout << "OK" << endl; }
		}
	}
}

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;
		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 <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

#define REP(i, n) for ( int i = 0; i < n; i++ )

using namespace std;

int main() {
    int n;
    vector<int> s(3);

    while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
        sort(s.begin(), s.end());

        // REP(i, 3) cout << s[i] << " ";
        // cout << endl;

        double size = sqrt(s[0] * s[0] + s[1] * s[1]);

        // cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;

        REP(i, n) {
            double r;
            cin >> r;
            // cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
            if ( r * 2 <= size )
                cout << "NA";
            else
                cout << "OK";
            cout << endl;

        }

    }

    return 0;
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a, b, c, n, r, p;
  while(cin >> a >> b >> c){
    p = max(a, b);
    p = max(p, c);
    cin >> n;
    while(n--){
      cin >> r;
      if(2*r > p)
	cout << "OK\n";
      else
	cout << "NA\n";
    }
  }
  return 0;
}