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 <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	for (int a, b, c; a = in(), b = in(), c = in(), a || b || c;) {
		int d = min(a, b), e = (d == a) ? min(b, c) : min(a, c);
		double o = sqrt(d * d + e * e) / 2;
		for (int n = in(); n--;)
			out(in() > o ? "OK" : "NA", '\n');
	}
}

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

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int sq(int a){
return a*a;
}

int main(){
	int l[3],t;
	int m,n,c=0;
	int r[10000];

	while(1){

		cin >> l[0] >> l[1] >> l[2];

		if((l[0]+l[1]+l[2])==0)break;

		cin >> n;

		//sort length
		sort(l,l+3);

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

			if((2*t > l[0]) && (sq(t*2)-sq(l[0]) > sq(l[1]))){
				r[i] = 1;
			}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 <iostream>
#include <algorithm>

using namespace std;

int main () {
	int d, w, h, n, r;
	while(true) {
		cin >> d >> w >> h;
		if (!d && !w && !h) break;

		int diagonal = min({
			d * d + w * w,
			d * d + h * h,
			h * h + w * w
		});

		cin >> n;
		while (n--) {
			cin >> r;
			cout << ((r * r * 4 > diagonal) ? "OK" : "NA") << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e4;

int main()
{
	lld d,w,h,n;
	lld r[MAXN] = {0};

	cin >> d >> w >> h;
	if (d == 0 && w == 0 && h == 0)
	{
		return 0;
	}

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

	double di[3] = {sqrt(d*d + w*w), sqrt(w*w + h*h), sqrt(h*h + d*d)};

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			if (2*r[i] > di[j])
			{
				cout << "OK" << endl;
				break;
			}

			if (j == 2)
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

struct data {
  double d, w, h, n, r[10000];
} d[50];

int check(int i, double r) {
  int a, b, c;
  double t[2];
  int tp = 0;  
  for (a = 0; a <= 1; a++)
    for (b = 0; b <= 1; b++)
      for (c = 0; c <= 1; c++)
        if ((a + b + c) == 2) {
          tp = 0;
          if (a == 1)
            t[tp++] = d[i].d;
          if (b == 1)
            t[tp++] = d[i].w;
          if (c == 1)
            t[tp++] = d[i].h;                   
          if (sqrt(pow(t[0]/2, 2)  + pow(t[1]/2, 2)) <r)
            return 1;                    
        }
  return 0;
}

int main() {
  int i, j, n;
  for (i = 0;; i++) {
    scanf("%lf %lf %lf", &d[i].d, &d[i].w, &d[i].h);
    if (d[i].d == 0 && d[i].w == 0 && d[i].h == 0)
      break;
    scanf("%lf", &d[i].n);
    for (j = 0; j < d[i].n; j++)
      scanf("%lf", &d[i].r[j]);
  }
  n = i;
  for (i = 0; i < n; i++) {
    for (j = 0; j < d[i].n; j++) {
      if (check(i, d[i].r[j]) == 1)
        printf("OK\n");
      else
        printf("NA\n");
    }
  }
  return 0;
}

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

#define REP(i, n) for ( int i = 0; i < n; i++ )

using namespace std;

int main() {
    int n;
    vector<int> s(3);

    while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
        sort(s.begin(), s.end());

        // REP(i, 3) cout << s[i] << " ";
        // cout << endl;

        double size = sqrt(s[0] * s[0] + s[1] * s[1]);

        // cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;

        REP(i, n) {
            double r;
            cin >> r;
            // cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
            if ( r * 2 <= size )
                cout << "NA";
            else
                cout << "OK";
            cout << endl;

        }

    }

    return 0;
}

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

const int MAX_N = 50;

int main(){
	double x, y, z, n;
	vector< pair<double, double> > h;
	vector< pair<double, double> > c;
	cin >>x >>y >>z;
	
	double temp = sqrt( x * x + y * y );
	c.push_back( make_pair(temp, temp) );
	temp = sqrt( z * z + y * y );
	c.push_back( make_pair(temp, temp) );
	temp = sqrt( z * z + x * x );
	c.push_back( make_pair(temp, temp) );
	
	cin >>n;
	for(int i = 0; i < n; i++){
		double tmp;
		cin >>tmp;
		h.push_back( make_pair(tmp * 2, tmp * 2) );
	}
	
	bool okflag = false;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 3; j++){
			if(h[i].first > c[j].first && h[i].second > c[j].second){
				okflag = true;
				cout <<"OK" <<endl;
				break;
			}
		}
		if(okflag == false) cout <<"NA" <<endl;
		okflag = false;
	}
	
	return 0;
}

C++: // 2011/01/14 Tazoe

#include <iostream>
using namespace std;

void ABC_sort(int& A, int& B, int& C)
{
	int tmp[3] = {A, B, C};

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

	A = tmp[0];
	B = tmp[1];
	C = tmp[2];
}

int main()
{
	while(true){
		int A, B, C;
		cin >> A >> B >> C;
		if(A==0&&B==0&&C==0)
			break;

		ABC_sort(A, B, C);
		int D = A*A+C*C;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int R;
			cin >> R;
			if(D<4*R*R)
				cout << "OK" << endl;
			else
				cout << "NG" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int i;
    int size[3];
    cin >> size[0] >> size[1] >> size[2];
    int NumOfHole;
    cin >> NumOfHole;
    int *radius;
    radius = new int[NumOfHole];
    for(i=0;i<NumOfHole;i++){
        cin >> radius[i];
    }
    int check[3];
    cin >> check[0] >> check[1] >> check[2];
    if(check[0]!=0 || check[1]!=0 || check[2]!=0){
        cout << "Misloading\n";
        return 0;
    }
    int max;
    int vmax=0;
    for(i=0;i<3;i++){
        if(vmax < size[i]){
            vmax=size[i];
            max=i;
        }
    }
    int obst=0;
    for(i=0;i<3;i++){
        if(i!=max){
            obst += size[i]*size[i];
        }
    }
    for(i=0;i<NumOfHole;i++){
        if(obst < 4*radius[i]*radius[i]){
            cout << "OK" << endl;
        }else{
            cout << "NA" << endl;
        }
    }
    return 0;
}