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

int main(){

  int cheeze[3], n, d, r, hole;

  while(cin >> cheeze[0] >> cheeze[1] >> cheeze[2]){
    if(cheeze[0] == 0) break;
    cin >> n;

    sort(cheeze, cheeze+3);
    r = sqrt(cheeze[0] * cheeze[0] + cheeze[1] * cheeze[1]);
    d = (int)round((double)cheeze[0] * cheeze[1] / r);

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

  return 0;

}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  //std::cin >> x;
  //size[0] = x;
  //std::cin >> x;
  //size[1] = x;
  //std::cin >> x;
  //size[2] = x;
  //std::sort(size.begin(), size.end());
  
  //while(size[0]==0 && size[1]==0 && size[2]==0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std::cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
    //std::cin >> x;
    //size[0] = x;
    //std::cin >> x;
    //size[1] = x;
    //std::cin >> x;
    //size[2] = x;
    //std::sort(size.begin(), size.end());
  //}
  
  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n,r;
vi d(3);

int main(){
	while(1){
		cin>>d[0]>>d[1]>>d[2];
		if(d[0]+d[1]+d[2]==0) break;
		sort(d.begin(),d.end());
		double tmp=(double)sqrt(d[0]*d[0]+d[1]*d[1]);
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>r;
			if(2*r>tmp) 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,mn,md;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mn=min(min(tate , yoko) , takasa);
		if(tate>=yoko){
			if(yoko>=takasa) {
			    md=yoko;
			} else if (yoko<takasa) {
				if(tate>=takasa)  md=takasa;
				else if (tate<takasa)  md=tate;
			}
			
		} else if (tate<yoko){
			if (tate>=takasa){
				md=tate;
			} else if(tate<takasa){
				if(yoko>=takasa) md=takasa;
				else if(yoko<takasa) md=yoko;
			}
		}
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mn*mn+md*md) ? "OK" : "NA") << endl;
			delete [] r;
		}
	}
	return 0; 
}

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

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

using namespace std;

int main() {
  int a, b, c;
  while (cin >> a >> b >> c, a) {
    double cheese = min({a * a + b * b, a * a + c * c, b * b + c * c});
    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
      int r;
      cin >> r;
      cout << ((4 * r * r <= cheese) ? "NA" : "OK") << endl;
    }
  }
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <string>
#define sqr(x) (x) * (x)
using namespace std;


// (height / 2) ^ 2 + (width / 2) ^ 2 <= r ^ 2

int main() {
	int height, width, depth, n, r;
	while(true){
		cin >> height >> width >> depth;
		if(height == 0 && width == 0 && depth == 0){
			break;
		}
		cin >> n;
		for(int i = 0;i < n;i++){
			cin >> r;
			string ans = "NA";
			int cnt = 0;
			if(sqr(height / 2.0) + sqr(width / 2.0) < r * r || sqr(height / 2.0) + sqr(depth / 2.0) < r * r || sqr(width / 2.0) + sqr(depth / 2.0) < r * r){
				ans = "OK";
			}
			cout << ans << endl;
		}
	}
	return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int a, b, c;
  while (cin >> a >> b >> c, a) {
    int n;
    cin >> n;
    int x = min({a * a + b * b, b * b + a * a, c * c + a * a});
    while (n--) {
      int r;
      cin >> r;
      cout << (x <= 4 * r * r ? "OK" : "NA") << endl;
    }
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int depth, width, height;
double a, b;

bool judge(int rad) {
    return(rad > sqrt(a+b));
}

int main(void) {
    while(cin >> depth >> width >> height, depth|(width|height)) {
        a = (width*width / 4.0);
        b = (height*height / 4.0);
        int num; cin >> num;
        for(int r = 0; r < num; r++) {
            int input; cin >> input;
            puts((judge(input)) ? "OK":"NA");
        }
    }
    return(0);
}

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

int main()
{
	int x, y, z, ins, i;
	int *input;
	cin >> x >> y >> z;
	cin >> ins;
	input = new int[ins]();
	for(i = 0; i<ins; i++)
		cin >> input[i];
	for(i = 0; i<ins; i++)
	{
		if(input[i]*2 < sqrt(x*x+y*y))
		{
			cout << "NA" << endl;
		}
		else
			cout << "OK" << endl;
	}
}