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<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi v(3);
  while(1){
    cin>>v[0]>>v[1]>>v[2];
    if(v[0]==0 && v[1]==0 && v[2]==0)break;
    sort(all(v));
    int n;
    cin>>n;
    double len=hypot(v[0],v[1])/2;
    rep(i,n){
      int r;
      cin>>r;
      if(r>len)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}

C++: #include<iostream>
#include<vector>
#include<cmath>
int main(){
	int a,b,c;
	std::cin>>a>>b>>c;
	int d;
	std::cin>>d;
	int p,q;
	if(a<b&&a<c){
		if(b<c){
			p=a*a+b*b;
		}else{
			p=a*a+c*c;
		}
	}else if(b<c&&b<a&&c<a){
		p=b*b+c*c;
	}
	q=sqrt(p);
	for(int i=0;i<d;i++){
		int n;
		std::cin>>n;
		if(2*n>q){
			std::cout<<"OK"<<std::endl;
		}else{
			std::cout<<"NA"<<std::endl;
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef long long ll;

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

int main(){
	ios::sync_with_stdio(false);

	int d, w, h;
	int n;
	int r[10000];

	double x1, x2, x3;

	while (1){
		cin >> d >> w >> h;

		if (d == 0 && w == 0 && h == 0){
			break;
		}

		cin >> n;

		x1 = sqrt(d*d + w*w)*0.5;
		x2 = sqrt(h*h + w*w)*0.5;
		x3 = sqrt(d*d + h*h)*0.5;


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

		for (int i = 0; i < n; i++){
			if (x1 < r[i] || x2 < r[i] || x3 < r[i]){
				printf("OK\n");
			}
			else{
				printf("NA\n");
			}
		}
	}

}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
	double d,w,h;
	while(~scanf("%lf %lf %lf",&d,&w,&h)){
		if(d==w && w==h && h==0) break;
		int n;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			double r;
			scanf("%lf",&r);
			if((d/2.0)*(d/2.0) + (h/2.0)*(h/2.0) < r*r
				|| (d/2.0)*(d/2.0) + (w/2.0)*(w/2.0) < r*r
				|| (w/2.0)*(w/2.0) + (h/2.0)*(h/2.0) < r*r)
			{
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}
	}
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	vector<int> args(3);
	while(cin>>args[0]>>args[1]>>args[2], args[0]||args[1]||args[2]){
		sort(args.begin(),args.end());
		int n;
		cin>>n;
		//double d  = args[0]*args[0] + args[1]*args[1];
		//cout<<args[0]<<":"<<args[1]<<endl;
		for(int x=0;x<n;++x){
			int r;
			cin>>r;
			double l = sqrt(2)*r;
			//if(4*r*r>d){
			if(l>(double)args[0] && l>(double)args[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main(void){
  int x,y,z,n,r;

  while(cin >> x >> y >> z,x|y|z){

    double a,b,c;
    a=sqrt(x*x+y*y);
    b=sqrt(y*y+z*z);
    c=sqrt(z*z+x*x);
    
    cin >> n;
    while(n--){
      cin >> r;
      r*=2;
      if(r>a||r>b||r>c)cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}

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

int main(){
	int data[3];
	while(std::cin>>data[0]>>data[1]>>data[2],data[0],data[1],data[2]){
		int n;
		double min;
		std::sort(data,data+3);
		std::cin>>n;
		min=sqrt(data[0]*data[0]+data[1]*data[1])/2;
		for(int i=0,r;i<n;i++){
			std::cin>>r;
			if(r>min)std::cout<<"OK"<<std::endl;
			else std::cout<<"NA"<<std::endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<math.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double x[3];
    int n;
    double e;

    while(cin >> x[0] >> x[1] >> x[2], x[2]){
        sort(x, x + 3);
        cin >> n;
        rep(i,n){
            cin >> e;
            if( sqrt(x[0] * x[0] + x[1] * x[1]) < 2 * e ){
                cout << "OK" << endl;
            }else{
                cout << "NA" << endl;
            }
        }

    }
}

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

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

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    vector<double> v(3);
    while (cin >> v[0] >> v[1] >> v[2], v[0])
    {
        int n;
        cin >> n;
        rep(i, n)
        {
            double r;
            cin >> r;
            sort(ALL(v));
            if (sqrt(v[0] * v[0] + v[1] * v[1]) < 2 * r)
                OP("OK");
            else
                OP("NA");
        }
    }

    return 0;
}

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

int main() {
 long long int a,b,c,n,r;
  cin >> a >> b >> c;
  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> r;
    cout << r << endl;
    if((a*a + b*b < 4*r*r) || (b*b + c*c < 4*r*r) || (c*c + a*a < 4*r*r)) {
      cout << "OK" << endl;
    }
    else
      cout << "NA" << endl;
  }
  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<=std::min(std::min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?"OK":"NA"))scanf("%d",&r);}