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++: /* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

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

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  int a, b, c;

  while (cin >> a >> b >> c, a || b || c){
    int dia[3] = {sqrt(a * a + b * b), sqrt(b * b + c * c), sqrt(c * c + a * a)};
    int n;
    cin >> n;
    int m = *min_element(dia, dia + 3);
    REP(i, n){
      int r;
      cin >> r;
      if (r * 2 > m) print("OK");
      else print("NA");
    }
  }

  return (0);
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back

int t, y, h, n;

void solve() {
  vector<int> s;
  s.pb(t); s.pb(y); s.pb(h);
  sort(s.begin(), s.end());
  double d1 = s[0] / 2.0;
  double d2 = s[1] / 2.0;
  cin>>n;
  rep(i,n) {
    double r; cin>>r;
    if (r*r > d1*d1 + d2*d2) {
      cout<<"OK"<<endl;
    } else {
      cout<<"NA"<<endl;
    }
  }
}

int main (int argc, char const* argv[]) {
  while (cin>>t>>y>>h, t||y||h) {
    solve();
  }
  return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int w, l, h;
	int n;
	int i;
	int x;
	
	while (1){
		scanf("%d %d %d", &w, &l, &h);
		if (w == 0 && l == 0 && h == 0)break;
		
		if (w > h){
			w += h;
			h = w - h;
			w -= h;
		}
		if (l > h){
			l += h;
			h = h -l;
			l -= h;
		}
		scanf ("%d", &n);
		
		for (i = 0; i < n; i++){
			scanf("%d", &x);
			
			if (w * l <= x * x / 2 * 3.141592){
				printf("OK\n");
			}else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

C++: #include <iostream>
int a,b,c,n,r;int main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    for(vi l(3); cin >> l[0], l[0];){
        COUNT(i, 2) cin >> l[i];
        sort(ALL(l));
    
        int n; cin >> n;
        while(n --){
            int r; cin >> r;
            cout << ((pow(l[0] / 2, 2.) + pow(l[1] / 2, 2.) < pow(r, 2.)) ? "OK":"NA") << endl;
        }
    }
 
    return 0;
}

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

int main(){
	int a, b, c;
	while(cin >> a >> b >> c, a+b+c){
		if(a > b){
			swap(a, b);
		}
		if(b > c){
			swap(b, c);
		}
		int n;
		cin >> n;
		int size_sq = a*a+b*b;
		while(n--){
			int r;
			cin >> r; 
			if(4*r*r > size_sq){
				cout << "OK" << endl;
			}else{
				cout << "NG" << endl;
			}
		}
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  while(1){
    int a,b,c,d[10010],n,i,j;
    cin >> a >> b >> c;
    if(a == 0 && b== 0 && c == 0){
      break;
    }
    cin >> n;
    for(i=0;i<n;i++){
      cin >> d[i];
      if(d[i]*2 > b && d[i]*2 > c && d[i]*2 > a){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}

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

using namespace std;

int main() {

	int c[3];

	while(cin >> c[0] >> c[1] >> c[2]) {
		if(!c[0]&&!c[1]&&!c[2]) {
			break;
		}
		sort(c, c+2);
		double R=sqrt(pow((double)c[0], 2)+pow((double)c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	return 0;

}

C++: /*
	Carry a Cheese
*/
#include	<iostream>
#include	<cmath>

using namespace std;

int main(void) {
	while(1){
		int lx, ly, lz, n;
		double dxy, dyz, dzx;
		
		cin >> lx >> ly >> lz;
		
		if(lx == 0 && ly == 0 && lz == 0) { break; }
		
		dxy = sqrt(lx * lx + ly * ly);
		dyz = sqrt(ly * ly + lz * lz);
		dzx = sqrt(lz * lz + lx * lx);
		
		cin >> n;
		
		for(int i = 0; i < n; i++) {
			int r;
			
			cin >> r;
			r *= 2;
			if(r > dxy || r > dyz || r > dzx) {
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

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

#define EPS 1e-7

using namespace std;
int main(){
    vector<int> in(3);
    while(cin >> in[0] >> in[1] >> in[2]){
        sort(in.begin(),in.end());
        if(in[2] == 0)break;
        int n;
        cin >> n;
        double l = hypot(in[1], in[0]);
        for(int i = 0; i < n; i++){
            double r;
            cin >> r;
            if(l + EPS < r*2)cout << "OK" << endl;
            else cout << "NA" << endl;
        }
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(void){
	while( true ){
		int n;
		int x,y,z;
		
		cin >> x >> y >> z;
		if( x==0&&y==0&&z==0 ) break;
		cin >> n;

		for(int i = 0; i < n; i++){
			int r;
			
			cin >> r;
			if( sqrt((double)x*x+y*y) < 2*r ||
				sqrt((double)x*x+z*z) < 2*r ||
				sqrt((double)y*y+z*z) < 2*r ) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}