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 <stdio.h>
#include <stdlib.h>

void judge(int x, int y, int z, int r);

int main(void)
{
    int cheese_x, cheese_y, cheese_z;
    scanf("%d", &cheese_x);
    scanf("%d", &cheese_y);
    scanf("%d", &cheese_z);
    int n;
    int cnt;
    scanf("%d", &n);
    for(cnt = 0; cnt < n; cnt++){
        int hole_size;
        scanf("%d", &hole_size);
        judge(cheese_x, cheese_y, cheese_z, hole_size);
    }
    return 0;
}

void judge(int x, int y, int z, int r)
{
    int t = r * r;
    int d_1, d_2, d_3;
    d_1 = (x / 2) * (x / 2) + (y / 2) * (y / 2);
    d_2 = (y / 2) * (y / 2) + (z / 2) * (z / 2);
    d_3 = (z / 2) * (z / 2) + (x / 2) * (x / 2);
    if(d_1 < t || d_2 < t || d_3 < t){
        printf("OK\n");
    } else {
        printf("NA\n");
    }
}

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

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		vector<int>s{ a,b,c };
		if (!a && !b && !c)break;
		sort(s[0],s[1]);
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			int f;
			cin >> f;
			if (f*2>s[1])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

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

using namespace std;

int main(){
  int size[3];
  while(~scanf("%d %d %d", &size[0], &size[1], &size[2]) && size[0] && size[1] && size[2]){
      sort(size, size + 3);
      double can = sqrt(size[0] * size[0] + size[1] * size[1]);
      int n;
      scanf("%d", &n);
      while(n--){
        int r;
        scanf("%d", &r);
        printf("%s\n", can < r * 2 ? "OK" : "NA");
      }
  }
  return 0;
}

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

class Cheese{
public:
	int x;
	int y;
	int z;
	double gr[3];

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

	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;

	double 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");
		}
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

double lng(int a, int b){
    double res = sqrt(a*a+b*b);
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    double d,w,h;
    int n;
    while(cin >> d >> w >> h){
        if(!d && !w && !h) break;
        cin >> n;
        double l1 = lng(d,w);
        double l2 = lng(w,h);
        double l3 = lng(h,d);
        double l = min( min(l1,l2), l3 );
        rep(i,n){
            double r;
            cin >> r;
            cout << (2.0*r > l ? "OK" : "NA") << endl;
        }
    }
      
    return 0;
}

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