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 x,y,z;
	while(cin >> x >> y >> z){
		double r = min(sqrt(x*x+y*y),min(sqrt(y*y+z*z),sqrt(z*z+y*y)));
		if(!r)
			break;
		int n;
		cin >> n;
		for(int i=0;i<n;i++){
			double R;
			cin >> R;
			R += R;
			if(R >= r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(void){
	std::ios_base::sync_with_stdio();
	int t,y,n;
	int data[3];
	double ja;
	int nn;
	int iri;

	while(cin>>t>>y>>n){
		if(t==0&&y==0&&n==0) break;
		data[0]=t,data[1]=y,data[2]=n;
		sort(data,data+3);
		ja=sqrt((data[1]*data[1])+(data[0]*data[0]));
		cin>>nn;
		for(int i=0;i<nn;i++){
			cin>>iri;
			if(2*iri>ja) cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
	return 0;
}

C++: 
#include<iostream>

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 <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;

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

int main(){
	int che[3];
	while(cin>>che[0]>>che[1]>>che[2],che[0]||che[1]||che[2]){
		sort(che,che+3);
		int R =che[0]*che[0]+che[1]*che[1];
		int n;
		cin>>n;
		rep(i, n){
			int r;
			cin>>r;
			r =2*r*2*r;
			if(r>R){
				cout <<"OK"<<endl;
			}else{
				cout <<"NA"<<endl;
			}
		}
		

	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>

using namespace std;

int R, n, data[3];

int main(void) {
    while(1) {
        scanf("%d%d%d", &data[0], &data[1], &data[2]);
        if(data[0] == 0 && data[1] == 0 && data[2] == 0) break;

        sort(data, data + 3);

        scanf("%d", &n);

        while(n > 0) {
            scanf("%d", &R);
            if(R * 2 > sqrt(data[0] * data[0] + data[1] * data[1])) {
                printf("OK\n");
            } else {
                printf("NA\n");
            }
            n--;
        }
    }
    return 0;
}

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

void cheese(int x,int y,int z){
    int number,tmp;
    list<int> hole;
    cin >> number;
    double xy = sqrt(x/2*x/2+y/2*y/2);
    double xz = sqrt(x/2*x/2+z/2*z/2);
    double zy = sqrt(z/2*z/2+y/2*y/2);
    
    for(int i=0;i<number;i++){
        cin >> tmp;
        hole.push_back(tmp);
    }
    list<int>::iterator it = hole.begin();
    for(;it != hole.end();it++){
        double r = (double)*it;
        //3つの面に対して原点を中心とした長方形を作る.
        if((r>xy)||(r>xz)||(r>zy))
            cout << "OK" << endl;
        else {
            cout << "NA"<< endl;
        }
    }
    
}

int main(){
    int x,y,z;
    cin >>x >> y>> z;
    while(x!=0 && y!=0&&z!=0){
        cheese(x,y,z);
        cin >> x>>y>>z;
    }
    return 0;
}

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

using namespace std; 

int main()
{
	vector<int> len(4);
	fill(len.begin(), len.end(), 1000000000);
	while(cin >> len[0] >> len[1] >> len[2])
	{
		if(!len[0] && !len[1] && !len[2])
			break;
		float rad;
		sort(len.begin(), len.end() );
		rad = sqrt(len[0]*len[0] + len[1]*len[1]);

		int num, enter[10100];
		cin >> num;

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

		for(int i = 0; i < num; i++)
		{
			if(2 * enter[i] > rad) cout << "OK" << endl;
			else cout << "NA" << endl; 
		}
	}
}

C++: #include<stdio.h>

int main(){

int x,y,z,N,r;
while(scanf("%d %d %d",&n[0],&n[1],&n[2])!=EOF){

for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

scanf("%d",&N);
for(int i=0;i<N;i++){

scanf("%d",&r);
if(n[1]>r*1.4141356)printf("NA\n");
else printf("OK\n");
}
}
return 0;
}

C++: #include <iostream>
#include <string>
#define MAX 10000
using namespace std;



int main(void){

  
  int  a ,b, h , n , hankei[MAX] , r[MAX] , nagai1 = MAX ,nagai2 = MAX ;
  
  string hantei[MAX];
  

  while(1){

    cin >> a >> b >> h ;

    if ( nagai1 > a ) nagai1 = a; 
    if ( nagai1 > b ){
      nagai2 = nagai1 ;
      nagai1 = b;
    }
    else nagai2 = b;

      if( nagai1 >=  h  > nagai2  ){ 
      nagai2 = nagai1;
      nagai1 = h;
    }
      else if( nagai2 > h) nagai2 = h ;

 

    if ( a == 0 && b == 0 && h ==0) break;


    cin >> n;


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


    
      cin >> r[i] ;


      // テδづつセテδεつイテδづつキテδεつッテδ暗つステδεつδεつェテδづつ、テδ偲つキテδ療つサテδづつサ

      if ( nagai1 * nagai1 + nagai2 * nagai2  < 4 * r[i] * r[i]  ) hantei[i] = "OK";
      

 


      else hantei[i] = "NA";



      

      //

      cout << hantei[i] << endl ;

    }


      

  }


  return 0;

}

C++: #include <iostream>
#define min(a, b) (a > b ? b : a)

int main() {
    int a, b, c;
    while (std::cin >> a >> b >> c && a && b && c) {
        int n;
        std::cin >> n;

        int min = min(min(a * a + b * b, b * b + c * c), a * a + c * c);
        for (int i = 0; i < n; i++) {
            int r;
            std::cin >> r;
            std::cout << (min < 4 * r * r ? "OK" : "NA") << std::endl;
        }
    }
}

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

using namespace std;

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


    while (cin >> a >> b >> c, a || b || c) {
        chk = min(a * a + b * b, min(b * b + c * c, a * a + c * c));

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

            cin >> r;
            if ((2 * r) * (2 * r) >= chk)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
        }
    }
    
    return 0;
}

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

int main()
{

	int a, b, c, n, r;

	while (cin >> a >> b >> c)
	{
		if ((a == 0) && (b == 0) && (c == 0)) break;

		double ab, bc, ac, taikaku;
		ab = sqrt(pow(a, 2) + pow(b, 2));
		bc = sqrt(pow(b, 2) + pow(c, 2));
		ac = sqrt(pow(a, 2) + pow(c, 2));
		taikaku = ab;
		if (taikaku>bc)
		{
			taikaku = bc;
		}
		else if (taikaku>ac)
		{
			taikaku = ac;
		}

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

	}
	return 0;
}