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 <iostream>

using namespace std;

int main()
{
	int N, A, B, C, R, Q;

	while (true)
	{
		cin >> A >> B >> C;

		if (A == 0 && B == 0 && C == 0)
		{
			break;
		}

		if (A > B) { swap(A, B); }
		if (A > C) { swap(A, C); }
		if (B > C) { swap(B, C); }

		Q = A * A + B * B;

		cin >> N;

		for (int i = 0; i < N; i++)
		{
			cin >> R;

			if (R * R * 4 > Q)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

#define sqr(x) ((x)*(x))

int main() {
	int a, b, c;
	
	while(cin >> a >> b >> c, a || b || c) {
		int n;
		double m;
		cin >> n;

		m = min(sqrt(sqr(a)+sqr(b)),min(sqrt(sqr(b)+sqr(c)),sqrt(sqrt(c)+sqr(a))));

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

	return 0;
}

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

int diagonal( int a, int b, int c ){
	if( a > c ) swap( a, c );
	if( b > c ) swap( b, c );
	return a*a + b*b;
}

int main()
{
	int a, b, c;
	while( cin >> a >> b >> c && !( a == 0 && b == 0 && c == 0 ) ){
		int dia_square = diagonal( a, b, c );

		int num;
		cin >> num;
		for( int i = 0; i < num; ++i ){
			int radius;
			cin >> radius;
			if( dia_square < radius * radius * 4 ){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main() {
  double c[3], n;

  while(cin >> c[0] >> c[1] >> c[2], c[0]+c[1]+c[2]) {
    sort(c, c+2);
    double size = sqrt(c[0]*c[0] + c[1]*c[1]);
    cin >> n;
    REP(i, n) {
      double r;
      cin >> r;
      if(2*r > size) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int a[3];
	while(a[0]=in(),a[1]=in(),a[2]=in()){
		int n=in();
		int i;
		sort(a,a+3);
		for(i=0;i<n;i++){
			int sz=in();
			if(a[0]*a[0]+a[1]*a[1]<4*sz*sz)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		int n; cin >> n;
		vector<double>R(n);
		rep(i, 0, n)cin >> R[i];
		int m = max(a, max(b, c));
		double x, y;
		if (m == a) {
			x = b; y = c;
		}
		else if (m == b) {
			x = a; y = c;
		}
		else {
			x = a; y = b;
		}

		double z = sqrt(x*x + y*y) / 2.0;

		rep(i, 0, n) {
			if (z < R[i])cout << "OK" << endl;
			else cout << "NA" << endl;
		}

	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	long long int a,s,d,f,g[100000],h,i,j,z,x,c,q[4];
	while(1){
			scanf("%lld %lld %lld",&a,&s,&d);
			if(a==0&&s==0&&d==0)	break;
		scanf("%lld",&f);
		for(i=0;i<f;i++)	scanf("%lld",&g[i]);
		q[0]=a*a+s*s;
		q[1]=a*a+d*d;
		q[2]=s*s+d*d;
		for(i=0;i<f;i++){
			j=(g[i]*2)*(g[i]*2);
			if(j<q[0]&&j<q[1]&&j<q[1])	printf("NA\n");
			else	printf("OK\n");
		}
	}
	return 0;
}

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

int main(){
  int i,j,n,a[3],flag,r;
  int na[3];
  while(1){
    cin >> a[0] >> a[1] >> a[2];
    if(a[0] == 0 && a[1] == 0 && a[2] == 0) break;
    cin >> n;

    for(i=0;i<2;i++) na[i] = a[i] * a[i] + a[i+1] * a[i+1];
    na[2] = a[2]*a[2] + a[0] * a[0];

    for(i=0;i<n;i++){
      cin >> r;
      flag = 0;
      for(j=0;j<3;j++){
	if(r*r*4 > na[j]){
	  flag = 1;
	  break;
	}
      }

      if(flag == 1) cout << "OK" << endl;
      else cout << "NA" << endl;
    }


  }
  return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
	/*(^(^(^(^(^o^)^)^)^)^) &#9602;&#9605;&#9607;&#9608;&#9619;&#9618;&#9617;('ω')&#9617;&#9618;&#9619;&#9608;&#9607;&#9605;&#9602; */
	double a,b,c,d,e;
	while(1){
	scanf("%lf%lf%lf",&a,&b,&c);
	if(a==0 && b==0 && c==0) break;
if(a<b){
	int w=a;
	a=b;
	b=w;
}
if(a<c){
	int w=a;
	a=c;
	c=w;
}
if(b<c){
	int w=b;
	b=c;
	c=w;
}
double u=sqrt(b*b+c*c);
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++){
int se;
scanf("%d",&se);
if(se*2>u) printf("OK\n");
else printf("NA\n");
}
}
	return 0;
}

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

//0107
int main(){
	int n, x, y, z, r, x2, y2, z2;
	while(cin >> x >> y >> z, x+y+z){
		x2=x*x;
		y2=y*y;
		z2=z*z;

		cin >> n;
		while(n--){
			cin >> r;
			cout << ((4*r*r > min(x2+y2, min(y2+z2, z2+x2))) ? "OK" : "NA");
			cout << endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double a[3];
  while(cin>>a[0]>>a[1]>>a[2],a[2]){
    int n;
    sort(a,a+3);
    double m=sqrt(a[1]*a[1]+a[0]*a[0]);
    cin>>n;
    while(n--){
      double p;
      cin>>p;
      if(p*2>m)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}