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;

double min( double a, double b )
{
    if( a > b )
        return b;
    else
        return a;
}

int main()
{
    int d, w, h, n, p;

    while( cin >> d >> w >> h )
    {
        if( d == 0 && w == 0 && h == 0 )
            break;

        double a = sqrt( d * d + w * d ), b = sqrt( d * d + h * h ), c = sqrt( w * w + h * h );
        double m = min( min( a, b ), min( b, c ) ) / 2;         //外接円の半径を求め、入り口の半径の大きさと比べる。

        cin >> n;

        for( int i = 0; i < n; i++ )
        {
            cin >> p;
            if( m < p )
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
        }
    }

    return 0;
}

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

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs(a-b)<EPS)

int main(){

	int wide,height,length;
	while(cin>>height>>wide>>length&&!(wide==0&&height==0&&length==0)){
		priority_queue<int,vector<int> ,greater<int>> pq;
		pq.push(height);
		pq.push(wide);
		pq.push(length);

		int l1,l2;
		l1=pq.top(),pq.pop();
		l2=pq.top(),pq.pop();
		int n;
		cin>>n;
		double d=sqrt(((double)l1/2)*((double)l1/2)+((double)l2/2)*((double)l2/2));
		for(int i = 0; i < n; i++){
			int r;
			cin>>r;
			// ツ禿シツづィツ古サツつイツづづ可チツーツズツつェツ運ツづ堕つアツづ淞づゥツつゥツ計ツ算
			if(!EQ(d,r)&&r>d)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}

	return 0;
}

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

int x[3],n;

int main(){
	while(cin >> x[0] >> x[1] >> x[2]){
		if(x[0]==0&&x[1]==0&&x[2]==0) break;
		sort(x,x+3);
		cin >> n;
		for(int i = 0; i < n; i++){
			int r; cin >> r;
			if(4*r*r > x[0]*x[0]+x[1]*x[1]) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    double x[3];
    int n;
    double a=0,r;
    for(;;){
        for(int i = 0;i < 3; i++)cin >> x[i];
        if(x[0] == 0&&x[1] == 0&&x[2] == 0)break;
        sort(x,x+3);

        a = sqrt((x[0]*x[0])+(x[1]*x[1]));

        cin >> n;

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

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

int main(){
	int h[3], n;
	double R[3], r, min;
	while (cin >> h[0] >> h[1] >> h[2]) {
		if (h[0] == 0 && h[1] == 0 && h[2] == 0) { break; }
		R[0] = pow(h[0], 2) + pow(h[1], 2);
		R[1] = pow(h[0], 2) + pow(h[2], 2);
		R[2] = pow(h[1], 2) + pow(h[2], 2);
		min = R[0];
		if(min>R[1]){
			min = R[1];
		}
		if(min>R[2]){
			min = R[2];
		}
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> r;
			r = pow(2 * r, 2);
			if(r > min){
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}

	}
	return 0;
}

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

int main(){

  double a[5],d,c;
  int n;

  while(cin >> a[0] >> a[1] >> a[2], a[0], a[1], a[2]){
    cin >> n;

    sort(a,a+3);

    c = sqrt(a[0]*a[0] + a[1]*a[1]);

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

      if(2*d > c) cout << "OK" << endl;
      else cout << "NA" << endl;

    }
  }
}

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

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

C++: #include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
#define mp(a,b) make_pair(a,b)
#define fr first
#define sc second
typedef pair<string,int> Pi;
int main(){
  int d[4],n,r;
  while(cin >> d[0] >> d[1] >> d[2] , d[0]){
    cin >> n;
    sort(d,d+3);
    int ans = d[0] * d[0] + d[1] * d[1];
    while(n--){
      cin >> r;
      cout << (r * r * 4 > ans ? "OK" : "NA") << endl;
    }
  }
}

C++: #include <iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int nijyou(int i ){return i*i;}
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;}
	sort(a,a+3);
	int n;
	cin>>n;
	double y = sqrt(nijyou(a[0])+nijyou(a[1]));
	for(int i = 0;i<n;i++){
		double k;
		cin>>k;
		if(k*2>y){cout<<"OK"<<endl;}
		else{cout<<"NA"<<endl;}
	}
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-6
using namespace std;

int main()
{
	vector<double> v;
	int a[3];
	while(true)
	{
		cin >> a[0] >> a[1] >> a[2];
		if(a[0] == 0 && a[1] == 0 && a[2] == 0)
		{
			break;
		}

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		double dis = v[0]*v[0] + v[1]*v[1];

		int n;
		cin >> n;

		while(n--)
		{
			double r;
			cin >> r;

			r *= 2;
			r *= r;

			if((r-dis) > EPS)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}

		}
	}
	return 0;
}

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

using namespace std;

int main(){
	double d, w, h;
	while(cin >> d >> w >> h, d || w || h){
		d = (d/2)*(d/2);
		w = (w/2)*(w/2);
		h = (h/2)*(h/2);
		
		int n;
		cin >> n;
		
		int r;
		for(int i = 0; i < n; i++){//input
			cin >> r;
			if(d+w < r*r || d+h < r*r || w+h < r*r ){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

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

int n, r;
int ch[3];

void solve() {
    double a, b, c;
    a = pow(ch[0], 2);
    b = pow(ch[1], 2);
    c = pow(2*r,   2);

    if (a+b < c) {
        std::cout << "OK" << std::endl;
    } else {
        std::cout << "NA" << std::endl;
    }
}

int main() {
    while (true) {
        for (int i=0; i<3; i++) std::cin >> ch[i];
        
        if (!ch[0] && !ch[1] && !ch[2]) break;
        
        std::sort(ch, ch+3);

        std::cin >> n;
        
        for (int i=0; i<n; i++) {
            std::cin >> r;
            solve();
        }
    }
}

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


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