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;

double h[10000];

int main(){
	int x;
	int y;
	int z;
	int n;
	double xy;
	double yz;
	double zx;
	while ( true ){
		cin >> x >> y >> z;
		if ( !x && !y && !z ){
			break;
		}
		cin >> n;
		for (int  i = 0; i < n; ++i){
			cin >> h[i];
		}
		xy = sqrt( x*x + y*y );
		yz = sqrt( y*y + z*z );
		zx = sqrt( z*z + x*x );
		for (int i = 0; i < n; ++i){
			bool flag = false;
			if( xy <= h[i]*2 || yz <= h[i]*2 || zx <= h[i]*2 ){
				flag = true;
			}
			if ( flag ){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

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

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int main(){
	int x,y,h;
	int m,n,c=0;
	int r[10000];
	float t;

	cin >> x >> y >> h >> n;

	//detect smalest surface
	m = x*y;
	if(m>x*h)m = x*h;
	if(m>y*h)m = y*h;

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

		//cout << t*R << endl;

		if(t==0){
			if(++c==3){
				break;
			}
		}

		if(m<2*t*t){
			if((t*R>x&&t*R>y)||(t*R>x&&t*R>h)||(t*R>h&&t*R>y)){
				r[i] = 1;
			}else{
				r[i] = 0;
			}
		}else{
			r[i] = 0;
		}
	}


	for(int i=0;i<n;i++){
		if(r[i]==0){
			cout << "NA" << endl;
		}else{
			cout << "OK" << endl;
		}
	}

	return 0;
}

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

using namespace std;

int main() {

	int c[3];

	while(cin >> c[0] >> c[1] >> c[2]) {
		if(!c[0]&&!c[1]&&!c[2]) {
			break;
		}
		sort(c, c+3);
		double R=sqrt(pow((double)c[0], 2)+pow((double)c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	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;

void sorting(int *a,int *b,int *c){
	vector<int> args;
	args.push_back(*a);
	args.push_back(*b);
	args.push_back(*c);
	sort(args.begin(),args.end());
	*a = args[0];
	*b = args[1];
	*c = args[2];
}

int main(){
	stringstream buf;
	int a,b,c;
	string line;
	getline(cin,line);
	sscanf(line.c_str(),"%d %d %d",&a,&b,&c);
	sorting(&a,&b,&c);
	getline(cin,line);
	getline(cin,line);
	while(line!="0 0 0"){
		int n;
		sscanf(line.c_str(),"%d",&n);
		double l = sqrt(2)*n;
		if(l>a && l>b){
			buf<<"OK\n";
		}else{
			buf<<"NA\n";
		}
		getline(cin,line);
	}
	cout<<buf.str();
	return 0;
}

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

using namespace std;

int mini_1(int i, int j, int k){
	if(i <= j && i <= k){
		return i;
	}else if(j <= i && j <= k){
		return j;
	}else{
		return k;
	}
}

int mini_2(int i, int j, int k){
	if(i <= j && j <= k){
		return j;
	}else if(k <= j && j <= i){
		return j;
	}else if(i <= j && k <= i){
		return i;
	}else if(j <= i && i <= k){
		return i;
	}else{
		return k;
	}
}

int main(){
	
	int a, b, c, n, min1, min2, r;
	
	cin >> a >> b >> c;
	
	while(a != 0 || b != 0 || c != 0){
		
		min1 = mini_1(a, b, c);
		min2 = mini_2(a, b, c);
		
		cin >> n;
		
		for(int i = 0; i < n; i++){
			cin >> r;
			if(4 * r * r > min1 * min1 + min2 * min2){
				printf("OK\n");
			}else{
				printf("NA\n");
			}
		}
		
		cin >> a >> b >> c;
	}
	
	return 0;
}

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

using namespace std;

int main(){
  double d,w,h;
  int x[3];
  int n;
  double r;
  while(1){
    cin >> d >> w >> h;
    if(d==0&&w==0&&h==0){
      return 0;
    }
    cin >> n;
    x[0]=pow((pow(d,2)+pow(w,2)),0.5)/2;
    x[1]=pow((pow(w,2)+pow(h,2)),0.5)/2;
    x[2]=pow((pow(d,2)+pow(h,2)),0.5)/2;
    int min=100000000;
    for(int i=0;i<3;i++){
      if(min>=x[i]){
        min=x[i];
      }
    }
    
    for(int i=0;i<n;i++){
      cin >> r;
      if(r>min){
        cout << "OK" <<endl;
      }else{
        cout << "NA" <<endl;
      }
    }
  }
}

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

using namespace std;

int main(void) {
	int h, w, d, n, r;
	int s, m, l;
	int i;

	while(true) {
		cin >> h >> w >> d;
		if(h == 0 && w == 0 && d == 0) { break; }
		cin >> n;
		for(i = 0; i < n; i++) {
			cin >> r;
			s = min(min(h,w),d);
			l = max(max(h,w),d);
			if(s == min(h,w) && l == max(h,w)) { m = d; }
			else if(s == min(h,d) && l == max(h,d)) { m = w; }
			else if(s == min(w,d) && l == max(w,d)) { m = h; }
			if(sqrt(s*s+m*m)/2 < r) {
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

int main(){
	int a,b,c,n,r;
	while(cin>>a>>b>>c,a|b|c){
		cin>>n;
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		while(n--){
			cin>>r;
			cout<<(a*a+b*b<4*r*r?"OK":"NA")<<endl;
		}
	}
	return 0;
}

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

int main()
{
	int x, y, z, ins, i;
	int *input;
	cin >> x >> y >> z;
	cin >> ins;
	input = new int[ins]();
	for(i = 0; i<ins+1; i++)
		cin >> input[i];
	for(i = 0; i<ins; i++)
	{
		if(input[i]*2 < sqrt(x*x+y*y))
		{
			cout << "NA" << endl;
		}
		else
			cout << "OK" << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
#define POW(u) ((u)*(u))
signed main(void){
	ios::sync_with_stdio(false);
	int a,b,c,n,x;
	while(cin>>a>>b>>c&&(a|b|c)){
		cin>>n;
		if(a>c)	swap(a,c);
		if(b>c)	swap(b,c);
		double MIN=POW((double)a/2.0)+POW((double)b/2.0);
		for(int i=1;i<=n;i++){
			cin>>x;
			if(POW(x)>MIN)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

int SideLength[3];

bool judgeResult(int r) {
	int squareOfSide;

	sort(SideLength, SideLength + 3);
	squareOfSide = pow(SideLength[0], 2) + pow(SideLength[1], 2);
	
	if (squareOfSide < r*r * 4) {
		return true;
	}
	return false;
}

int main() {
	int n, r;

	while (1) {
		cin >> SideLength[0] >> SideLength[1] >> SideLength[2];
		if (SideLength[0] == 0 && SideLength[1] == 0 && SideLength[2] == 0) {
			break;
		}

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


	return 0;
}

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

using namespace std;


int main(){

	double d,w,h,r,min_dist,dist1,dist2,dist3;
	int n;

	while(true){
		scanf("%lf %lf %lf",&d,&w,&h);
		if(d == 0.0 && w == 0.0 && h == 0.0)break;

		scanf("%d",&n);

		for(int i=0; i < n; i++){
			scanf("%lf",&r);
			dist1 = (sqrt(d*d+w*w))/2.0;
			dist2 = (sqrt(w*w+h*h))/2.0;
			dist3 = (sqrt(d*d+h*h))/2.0;
			min_dist = min(dist1,min(dist2,dist3));
			if(r > min_dist){
				printf("OK\n");
			}else{
				printf("NA\n");
			}
		}
	}

    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
//#define M(a,b) a<b?a:b
int main(){
	int a,b,c,n,r;
	for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2.*r<=std::min(std::min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}