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>
#include<cmath>
using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;
int n;
while(1){
cin >> w >> h >> d;
if(w+h+d==0) break;
cin >> n;
while(n--){
cin >> r;
r*=2;
double dw,dh,dd;
dw=sqrt(w*w+h*h);
dh=sqrt(h*h+d*d);
dd=sqrt(d*d+w*w);
if(dw<r||dh<r||dd<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int l,w,h,m,n,r;
  for(;;){
    cin >> l >> w >> h;
    if(l==0 && w==0 && h==0) break;
    if(max(l,max(w,h)) == l) m = w*w + h*h;
    else if(max(l,max(w,h)) == w) m = l*l + h*h;
    else m = l*l + w*w;
    cin >> n;
    while(n--){
      cin >> r;
      if((2*r)*(2*r) > m) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

void solve(){
}

int main(){
  double a,b,c;

  while(cin>>a>>b>>c,a||b||c){
    double len = min(a*a+b*b, min(a*a+c*c, b*b+c*c));
    int n;
    cin>>n;

    rep(i,n){
      double r;
      cin>>r;
      r *= 2;
      if(len >= r*r){
        cout<<"NA\n";
      }
      else{
        cout<<"OK\n";
      }
    }
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int t[3];
double limit,r;
int n;
int main(){
  while(cin>>t[0]>>t[1]>>t[2]){
    if(t[0]==0)break;
    sort(t,t+3);
    limit=sqrt(t[0]*t[0]+t[1]*t[1]);
    cin>>n;
    while(n--){
      cin>>r;
      if(r*2>limit){
	cout<<"OK"<<endl;
      }else{
	cout<<"NA"<<endl;
      }
    }
  }
  return 0;
}

C++: #define scanf_s scanf
//#define sscanf_s sscanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1001
#define _MAX 100
#define HO 6
int main(void)
{
	while (1) {
		int d, w, h, n, r;
		scanf_s("%d %d %d", &d, &w, &h);
		if ((d == 0 && w == 0) && h == 0) break;
		scanf_s("%d", &n);
		for (int i = 0; i < n; ++i) {
			scanf_s("%d", &r);
			bool ny = false;
			if ((w < r * 2 && h < r* 2) && d < r * 2) {
				ny = true;
			}
			if (ny) 	printf("OK\n");
			else 	printf("NA\n");

		}
	}
}

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