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<string>
#include<math.h>
using namespace std;

int main(){
  int d,w,h;int n;
  while(true){
    cin>>d>>w>>h;
    if(d==0&&w==0&&h==0)break;
    if(d>w)swap(w,d);
    if(w>h)swap(h,w);
    cin>>n;
    int r;
    for(int i=0;i<n;i++){
      cin>>r;
      if(sqrt(d*d+w*w)<r*2)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}

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

using namespace std;

int main(int argc, char const* argv[])
{
	double a,b,c,d;

	while( cin >> a >> b >> c && a != 0 ){
		double h[3];
		h[0] = sqrt( a * a + b * b );
		h[1] = sqrt( a * a + c * c );
		h[2] = sqrt( b * b + c * c );

		cin >> d;
		for( int i = 0;i < d;i++ ){
			double n;
			cin >> n;
			n *= 2;

			int j;
			for( j = 0;j < 3;j++ ){
				if( n > h[j] ){ cout << "OK" << endl; break; }
			}
			if( j == 3 ) cout << "NA" << endl;
		}
	}


	return 0;

}

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

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs(a-b)<EPS)

int main(){

	int wide,height,length;
	while(cin>>height>>wide>>length&&!(wide==0&&height==0&&length==0)){
		priority_queue<int,vector<int> ,greater<int> > pq;
		pq.push(height);
		pq.push(wide);
		pq.push(length);

		int l1,l2;
		l1=pq.top(),pq.pop();
		l2=pq.top(),pq.pop();
		int n;
		cin>>n;
		double d=sqrt(((double)l1/2)*((double)l1/2)+((double)l2/2)*((double)l2/2));
		for(int i = 0; i < n; i++){
			int r;
			cin>>r;
			// ツ禿シツづィツ古サツつイツづづ可チツーツズツつェツ運ツづ堕つアツづ淞づゥツつゥツ計ツ算
			if(!EQ(d,r)&&r>d)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}

	return 0;
}

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

int main(){

int x,y,z,N,r;
int n[1001]={};
while(1){
scanf("%d %d %d",&n[0],&n[1],&n[2]);if(n[0]==0&&n[1]==0&&n[2]==0)break;
for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

//printf("%d %d %d\n",n[0],n[1],n[2]);

double rad=atan2( (double)(n[1]), (double)(n[0]));
//rad=rad*3.141592/180;
//printf("%lf\n",rad);

scanf("%d",&N);
for(int i=0;i<N;i++){

scanf("%d",&r);
//printf("%d %lf\n",n[1],(r*2*sin(rad)));



if(n[1]>=(int)(r*2*sin(rad)))printf("NA\n");
else printf("OK\n");
}
}
return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    int a, b, c;
    while(cin >> a >> b >> c && (a || b || c) ) {
        int r = min( min(a * a + b * b, a * a + c * c), b * b + c * c);
        int n;
        cin >> n;
        for(int i = 0; i < n; i++) {
            int d;
            cin >> d;
            if ( r >= d * d * 4 ) {
                cout << "NA" << endl;
            } else {
                cout << "OK" << endl;
            }
        }
    }
     
    return 0;
}

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

int main(void)
{
	double len;
	double wid;
	double hei;
	double s[3];
	int n;
	int ent;
	int entd;
	int min;
	int i, j;
	
	while (1){
		scanf("%lf %lf %lf", &len, &wid, &hei);
		if (len == 0 && wid == 0 && hei == 0){
			break;
		}
		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d", &ent);
			entd = ent * 2;
			s[0] = sqrt(len * len + wid * wid);
			s[1] = sqrt(wid * wid + hei * hei);
			s[2] = sqrt(len * len + hei * hei);
			
			min = s[0];
			for (j = 1; j < 3; j++){
				if (min > s[j]){
					min = s[j];
				}
			}
			if (entd > min) printf("OK\n");
			else printf("NA\n");
		}
	}
	return (0);
}

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

int size[3],n,radius;
int d[10000];

int main(){
	while(std::cin>>size[0]>>size[1]>>size[2] ,(size[0]||size[1]||size[2]) ){
		std::sort(size,size+3);
		std::cin>>n;
		while( n-- ){
			std::cin>>radius;
			if( pow(radius*2,2) <= pow((float)size[0],2) + pow((float)size[1],2) )
				std::cout<<"NA"<<std::endl;
			else std::cout<<"OK"<<std::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() {
  int c[3], n;

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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int tate,yoko,takasa,mx,mn;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mx=max(max(tate , yoko) , takasa);
		mn=min(min(tate , yoko) , takasa);
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mx*mx+mn*mn) ? "OK" : "NA") << endl;
		}
	}
	return 0; 
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return b.second > a.second;
    }
    return a.first < b.first;
}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    double d, w, h;
    while (cin >> d >> w >> h)
    {
        if (d == 0 && w == 0 && h == 0)
            break;

        double dist = min({sqrt(h * h + w * w) / 2.0, sqrt(h * h + d * d) / 2.0, sqrt(w * w + d * d) / 2.0});
        int n;
        cin >> n;
        for (int i = 0; i < n; ++i)
        {
            double r;
            cin >> r;
            if (r > dist)
            {
                cout << "OK" << endl;
            }
            else
                cout << "NA" << endl;
        }
    }
    return 0;
}