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 <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();
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi v(3);
  while(1){
    cin>>v[0]>>v[1]>>v[2];
    if(v[0]==0 && v[1]==0 && v[2]==0)break;
    sort(all(v));
    int n;
    cin>>n;
    double len=hypot(v[0],v[1])/2;
    rep(i,n){
      int r;
      cin>>r;
      if(r>len)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}

C++: #include<iostream>
#include<vector>
#include<cmath>
int main(){
	int a,b,c;
	std::cin>>a>>b>>c;
	int d;
	std::cin>>d;
	int p,q;
	if(a<b&&a<c){
		if(b<c){
			p=a*a+b*b;
		}else{
			p=a*a+c*c;
		}
	}else if(b<c&&b<a&&c<a){
		p=b*b+c*c;
	}
	q=sqrt(p);
	for(int i=0;i<d;i++){
		int n;
		std::cin>>n;
		if(2*n>q){
			std::cout<<"OK"<<std::endl;
		}else{
			std::cout<<"NA"<<std::endl;
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int main(){
	ios::sync_with_stdio(false);

	int d, w, h;
	int n;
	int r[10000];

	double x1, x2, x3;

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

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

		cin >> n;

		x1 = sqrt(d*d + w*w)*0.5;
		x2 = sqrt(h*h + w*w)*0.5;
		x3 = sqrt(d*d + h*h)*0.5;


		for (int i = 0; i < n; i++){
			cin >> r[i];
		}

		for (int i = 0; i < n; i++){
			if (x1 < r[i] || x2 < r[i] || x3 < r[i]){
				printf("OK\n");
			}
			else{
				printf("NA\n");
			}
		}
	}

}