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 <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toStr(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	vi s(3);
	while(cin >> s[0] >> s[1] >> s[2], s[0]) {
		sort(ALL(s));
		double lim = sqrt(s[0]*s[0]+s[1]*s[1]);

		int n, r;
		cin >> n;
		REP(_, n) {
			cin >> r;
			if(lim < 2*r) {
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

double get_d(int a, int b, int c)
{
  int num[3];
  num[0] = a;
  num[1] = b;
  num[2] = c;
  sort(num, num + 3);
  return sqrt(pow(num[0], 2) + pow(num[1], 2));
}

int main()
{
  while(true)
  {
    int a, b, c, n;
    double d;
    cin >> a >> b >> c;
    if(!a && !b && !c)
      break;
    cin >> n;
    d = get_d(a, b, c);
    for(int i = 0; i < n; i++)
    {
      int r;
      cin >> r;
      cout << (r * 2 > d ? "OK" : "NA") << endl;
    }
  }
}

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

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;




int main(){
	vi v(3);
	int n,r;
	while(cin>>v[0]>>v[1]>>v[2]){
		if(v[0]==0&&v[1]==0&&v[2]==0)break;
		sort(all(v));
		int d=(v[0]*v[0]+v[1]*v[1]);
		cin>>n;
		rep(i,n){
			cin>>r;
			r*=r;
			r*=4;
			if(r>d)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

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

int main() {
  int x, y, z, n, r, a, b, c;

  while (1) {
    scanf("%d %d %d", &x, &y, &z);
    if (!x && !y && !z) break;
    scanf("%d", &n);
    if (x>y && x>z) {
      a = y;
      b = z;
    } else if (y>z) {
      a = z;
      b = x;
    } else {
      a = x;
      b = y;
    }
    c = floor(sqrt((a*a+b*b)*0.25))+1;
    for (int i=0; i<n; i++) {
      scanf("%d", &r);
      if (r < c) {
        printf("NA\n");
      } else {
        printf("OK\n");
      }
    }
  }

  return 0;
}

C++: // This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>

int main()
{
    while (true) {
        int d, w, h;
        std::cin >> d >> w >> h;
        if (d == 0 && w == 0 && h == 0) {
            break;
        }
        
        float dw_r, dh_r, wh_r;
        dw_r = std::sqrt(d * d + w * w) / 2.0f;
        dh_r = std::sqrt(d * d + h * h) / 2.0f;
        wh_r = std::sqrt(w * w + h * h) / 2.0f;
        
        int n;
        std::cin >> n;
        std::vector<int> r(n);
        for (int i = 0; i < n; i++) {
            std::cin >> r[i];
            if (dw_r < r[i] || dh_r < r[i] || wh_r < r[i]) {
                printf("OK\n");
            } else {
                printf("NA\n");
            }
        }
    }
    
    return 0;
}

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

using namespace std;

int CarryCheese(double, double, double);

int main(){
  int i, n, hole, result, data[3];

  while(1){
    for(i=0; i<3; ++i)
      cin >> data[i];
    if(data[0] == 0 && data[1] == 0 && data[2] == 0) break;

    sort(data, data+3);

    cin >> n;
    for(i=0; i<n; ++i){
      cin >> hole;
      result = CarryCheese(((double)data[0])/2, ((double)data[1])/2, (double)hole);
      if(result == 1)
	cout << "OK" << endl;
      else
	cout << "NA" << endl;
    }
  }

  return 0;
}


int CarryCheese(double x, double y, double h){
  if(x >= h)
    return 0;
  else if(y < sqrt(h*h - x*x))
    return 1;
  else
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
	double d,w,h,n,r,a,b,c,m;
	while(cin>>d>>w>>h,d!=0&&w!=0&&h!=0){
		a=sqrt(d*d+w*w);
        b=sqrt(d*d+h*h);
        c=sqrt(w*w+h*h);
		m=min(a,min(b,c));
		cin>>n;
		while(n--){
			cin>>r;
			r=r*2;
			if(m<r)cout<<"OK\n";
			else cout<<"NA\n";
		}
	}
	return 0;
}

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

#define int64 long long int

using namespace std;
typedef pair<int, int> P;

int main()
{
    int x, y, z, n, buf, r;
    while(1){
        cin >> x >> y >> z;
        if(x == 0) break;
        cin >> n;
        
        if(x > y){
            buf = x;
            x = y; 
            y = buf;
        }
        if(y > z){
            buf = y;
            y = z;
            z = buf;
        }
        if(x > y){
            buf = x;
            x = y;
            y = buf;
        }
        
        for (int i=0; i<n; i++) {
            cin >> r;
            if(2*r*2*r > x*x + y*y) cout << "OK";
            else cout << "NA";
            cout << endl;
        }
    }
    return 0;
}