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>
#include <cmath>
using namespace std;
int main(){
    while(true){
        int d,w,h,n,r[10000],a=0,b=0;
        float c=0;
        cin>>d>>w>>h;
        if(d+w+h==0)break;
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>r[i];
        }
        a=d;
        if(a>w){
            swap(a,w);
        }
        b=w;
        if(w>h){
            b=h;
        }
        c=a*a+b*b;
        c=sqrt(c);
        for(int i=0;i<n;i++){
            if(2*r[i]>c)cout<<"OK"<<endl;
            else{
                cout<<"NA"<<endl;
            }
        }
    }
}

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

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> size[0];
  std::cin >> size[1];
  std::cin >> size[2];
  std::sort(size.begin(), size.end());
  
  while(size[0]==0 && size[1]==0 && size[2]==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;
      }
    }
    std::cin >> size[0];
    std::cin >> size[1];
    std::cin >> size[2];
    std::sort(size.begin(), size.end());
  }
  
  return 0;
}

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

int main(void){
        int d,w,h;
        int size;
        int n,r;
        while(1) {
                cin>>d>>w>>h;
                if(d==0 and w==0 and h==0) return 0;
                cin>>n;
                size=min(d*d+w*w,min(d*d+h*h,w*w+h*h));
                for(int i=0;i<n;i++){
                    cin>>r;
                    if(size<4*r*r){//size**0.5<2*r;
                        cout<<"OK"<<endl;
                    }
                    else{
                        cout<<"NA"<<endl;
                    }
                }
        }

}

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

#define int64 long long int

using namespace std;
typedef pair<int, int> P;

int main()
{
    int x, y, z, n, buf, r;
    double dx, dy, rsq;
    while(1){
        cin >> x >> y >> z;
        if(x == 0) break;
        cin >> n;
        
        if(x > y){
            buf = x;
            x = y; 
            y = buf;
        }
        if(y > z){
            buf = y;
            y = z;
            z = buf;
        }
        if(x > y){
            buf = x;
            x = y;
            y = buf;
        }
        
        dx = x;
        dy = y;
        
        rsq = (dx/2)*(dx/2) + (dy/2)*(dy/2);
        
        for (int i=0; i<n; i++) {
            cin >> r;
            if(r*r > rsq) cout << "OK";
            else cout << "NA";
            cout << endl;
        }
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

int x,y,z,n;

int sq(int a){return a*a;}

void solve()
{
	int a[3] = {x,y,z};
	sort(a,a+3);
	int r2 = sq(a[0]) + sq(a[1]);
	cin>>n;
	for (int i = 0; i < n; i++){
		int b; cin>>b;
		puts((r2 <= 4*b*b) ? "NA" : "OK");
	}
}

int main(){
	while(cin>>x>>y>>z,(x||y||z)){
		solve();
	}

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int number;
	cin>>number;
int r[100];
int n=0;

while(true){
	int temp;
	cin>>temp;
	if(n>=2&&temp==0&&r[n-1]==0&&r[n-2]==0){
		break;
	}
	else{
		r[n]=temp;
		n=n++;
	}
}
	int rec1,rec2,rec3;
	rec1=a*a+b*b;
	rec2=a*a+c*c;
	rec3=b*b+c*c;


	for (int i=0;i<(n-2);i++){
	 if (4*r[i]*r[i]>rec1||4*r[i]*r[i]>rec2||4*r[i]*r[i]>rec3){
		 cout<<"OK"<<endl;
	 }
	 else{
		 cout<<"NA"<<endl;
	 }
	}
return 0;

}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int d[3];
	while (cin >> d[0] >> d[1] >> d[2], d[0] | d[1] | d[2] ){
		vector<int> dx(3);
		REP(i, 3){
			dx[i] = d[i] * d[i] + d[(i + 1) % 3] * d[(i + 1) % 3];
		}
		SORT(dx);
		int n;
		cin >> n;
		vector<int> s(n);
		REP(i, n){
			cin >> s[i];
		}
		REP(i, n){
			if (dx[1] < (s[i] * 2))
				cout << "OK"<<endl;
			else
				cout << "NA" << endl;
		}
	}
}

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

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