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 <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	int d, w, h;
	int cheese[3];
	while (cin >> d >> w >> h && d && w && h) {
		cheese[0] = d;
		cheese[1] = w;
		cheese[2] = h;
		sort(cheese, cheese+3);
		double cr = sqrt(pow(cheese[0] / 2, 2) + pow(cheese[1] / 2, 2));
		int n;
		cin >> n;
		for (int i = 0; i < n; i++) {
			double r;
			cin >> r;
			if (r > cr)
				cout << "OK" << endl;
			else
				cout << "NA" << 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+2, greater<int>());
    double 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 <algorithm>
using namespace std;

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

C++: #include<stdio.h>
#include<math.h>
int main(void)
{
	int t,y,h,n;
	int s,s1,s2[10000],i;
	int r[10000];

	scanf("%d %d %d",&t,&y,&h);
	while(t!=0 && y!=0 && h!=0){
		s=t*t+y*y;
		s1=sqrt(s);
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d",&r[i]);
			s2[i]=r[i]*2;
			if(s1<=s2[i]){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}
		scanf("%d %d %d",&t,&y,&h);
	}
	return 0;
}

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

int main(void){
	int a[3];
	int n;
	int r;
	while(cin>>a[0]>>a[1]>>a[2],a[0]){
		sort(a,a+3);
		int x=(a[0]*a[0]+a[1]*a[1])/4;
		cin>>n;
		while(n--){
			cin>>r;
			r*=r;
			if(x<r)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
	return 0;
}

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

int main() {
	int d[3];
	while (cin >> d[0] >> d[1] >> d[2], d[0], d[1], d[2]) {
		int n;
		cin >> n;
		sort(d, d + 3);
		long double c = sqrt(d[0] * d[0] + (d[1] * d[1]));
		for (int i = 0;i < n;i++) {
			int a;
			cin >> a;
			if (a*2 > c)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	vector<double>a(3);
	while(cin>>a[0]>>a[1]>>a[2],a[0]){
		sort(all(a));
		double r=hypot(a[0],a[1])/2;
		int n;
		cin>>n;
		rp(n){
			int m;cin>>m;
			if(m>r)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	long long int a,s,d,f,g[100000],h,i,j,z,x,c,q[4];
	while(1){
			scanf("%lld %lld %lld",&a,&s,&d);
			if(a==0&&s==0&&d==0)	break;
		scanf("%lld",&f);
		for(i=0;i<f;i++)	scanf("%lld",&g[i]);
		q[0]=a*a+s*s;
		q[1]=a*a+d*d;
		q[2]=s*s+d*d;
		for(i=0;i<f;i++){
			j=(g[i]*2)*(g[i]*2);
			if(j<=q[0]&&j<=q[1]&&j<=q[2])	printf("NA\n");
			else	printf("OK\n");
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int n, r, d, w, h, x;
	while (1) {
		cin >> d >> w >> h;
		if (d + w + h == 0)
			return 0;
		if (d <= h && w <= h)
			x = d * d + w * w;
		else if (d <= w && h <= w)
			x = d * d + h * h;
		else if (w <= d && h <= d)
			x = w * w + h * h;
		cout << x;
		cin >> n;
		for (int lop = 0; lop < n; lop++) {
			cin >> r;
			if (4*r*r > x)
				cout << "OK\n";
			else
				cout << "NA\n";
		}
	}
	return 0;
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	double x, y, z;
	while (cin >> x >> y >> z&&(x||y||z)) {
		double v = min(max(x, y), min(max(x, z), max(y, z)));
		int n;
		cin >> n;
		for (int i = 0; i < n; i++)
		{
			double r;
			cin >> r;
			if (fabs(v - r*sqrt(2.0))<=EPS||v>r*sqrt(2.0))
				cout << "NA" << endl;
			else
				cout << "OK" << endl;
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

int x,y,z,n;

ll sq(ll a){return a*a;}

void solve()
{
	ll a[3] = {x,y,z};
	sort(a,a+3);
	ll r2 = sq(a[0]) + sq(a[1]);
	cin>>n;
	for (int i = 0; i < n; i++){
		ll b; cin>>b;
		puts((r2 >= 4*b*b) ? "NA" : "OK");
	}
}

int main(){
	while(cin>>x>>y>>z,(x||y||z)){
		solve();
	}

    return 0;
}