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++: //============================================================================
// 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 <cstdio>
#include <cmath>
#include <iostream>

double CalcGr(int x,int  y);

class Cheese{
public:
	int x;
	int y;
	int z;
	double gr[3];
	Cheese(){
//		scanf("%d %d %d", &x, &y, &z);
		std::cin >> x >> y >> z;
		gr[0] = CalcGr(x, z);
		gr[1] = CalcGr(x, y);
		gr[2] = CalcGr(y, z);
	}
};

int main(){
	Cheese c;
	
	int n;
//	scanf("%d", &n);
	std::cin >> n;

	int r;
	for (int i = 0; i < n; i++){
//		scanf("%d", &r);
		std::cin >> r;
		if (c.gr[0] < r || c.gr[1] < r || c.gr[2] < r){
			printf("OK\n");
		}
		else{
			printf("NA\n");
		}
	}
}

double CalcGr(int x, int y){
	return sqrt((double)(x*x + y*y)) / 2;
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  long ver,hor,height;
  while(1){
    cin>>ver>>hor>>height;
    if(!ver && !hor && !height)break;
    int n;
    int dis[3];
    dis[0]=sqrt(ver*ver+hor*hor);
    dis[1]=sqrt(hor*hor+height*height);
    dis[2]=sqrt(height*height+ver*ver);
    cin>>n;
    rep(i,n){
      int r;
      cin>>r;
      int cnt=0;
      rep(i,3){
	if(2*r>dis[i])cnt++;
      }
      if(cnt==0)cout<<"NA"<<endl;
      else cout<<"OK"<<endl;
    }
  }
  return 0;
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <string>
#define sqr(x) (x) * (x)
using namespace std;


// (height / 2) ^ 2 + (width / 2) ^ 2 <= r ^ 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(sqr(height / 2.0) + sqr(width / 2.0) <= r * r || sqr(height / 2.0) + sqr(depth / 2.0) <= r * r || sqr(width / 2.0) + sqr(depth / 2.0) <= r * r){
				ans = "OK";
			}
			cout << ans << endl;
		}
	}
	return 0;
}

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

int main() {
double x, w, h, n, r, min_r, t;
while(cin>>x>>w>>h, x||w||h){
t = max(max(x, w), h);
min_r = x*x+w*w+h*h-t*t;
cin>>n;
while(n--){
cin>>r;
r =r*r*4;
min_r<r ? cout<<"OK\n" : cout<<"NA\n";
}
} 
return 0;
}

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

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

bool check(int y, int x, int h, int r){
  int rr = r * 2, yy = y * y, xx = x * x, hh = h * h;
  if(sqrt(yy + xx) < rr) return true;
  if(sqrt(yy + hh) < rr) return true;
  if(sqrt(xx + hh) < rr) return true;
  return false;
}

int main() {
  int y, x, h;
  while(cin >>y >>x >>h && y){
    int n; cin >>n;
    REP(i, n){
      int r; cin >>r;
      if(check(y, x, h, r)) cout <<"OK" <<endl;
      else cout <<"NA" <<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	vector<int> args(3);
	cin>>args[0]>>args[1]>>args[2];
	sort(args.begin(),args.end());
	int n;
	cin>>n;
	for(int x=0;x<n;++x){
		int r;
		cin>>r;
		if(4*r*r > args[0]*args[0] + args[1]*args[1]){
			cout<<"OK"<<endl;
		}else{
			cout<<"NA"<<endl;
		}
	}
	cin>>args[0]>>args[1]>>args[2];
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14
 
int main(){
    double en;
    double i,y,k;
    int n;
    while(cin >> i >> y >> k , i * y * k){
        double min = sqrt (i * i + y * y);
        if(min > sqrt (k * k + y * y) ) min = sqrt (k * k + y * y);
        if(min > sqrt (i * i + k * k) ) min = sqrt (i * i + k * k);
        cin>>n;
        for(int i = 0 ; i < n ; i++){
            double m;
            cin>>m;
            //cout<<1.0*2*m<<" "<<min<<endl;
             if(1.0*min<1.0*m*2)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);
        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;
}