Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		line := strings.Split(stdin.Text(), " ")
		len := []int{}
		for i := 0; i < 3; i++ {
			tmp, _ := strconv.Atoi(line[i])
			len = append(len, tmp)
		}
		if len[0] == 0 && len[1] == 0 && len[2] == 0 {
			break
		}
		sort.Ints(len)
		d2 := len[0]*len[0] + len[1]*len[1]
		stdin.Scan()
		n, _ := strconv.Atoi(stdin.Text())
		for i := 0; i < n; i++ {
			stdin.Scan()
			r, _ := strconv.Atoi(stdin.Text())
			if 4*r*r > d2 {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>

#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif

#define ITER(c)             __typeof__((c).begin())
#define FOREACH(it, c)      for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c)            __typeof__((c).rbegin())
#define RFOREACH(it, c)     for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n)           REPEAT(i, 0, n)
#define RREP(i, n)          RREPEAT(i, 0, n)
#define REPEAT(i, k, n)     for(int i = (k); i < (k+n); ++i)
#define RREPEAT(i, k, n)    for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t)       for(int i = f; i < t; i++)
#define ALL(c)              (c).begin(), (c).end()
#define LLPOW(p1,p2)        ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A)          (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC         do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p)           fgets((p), sizeof(p), stdin)
#define CHOMP(p)            do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v)           memset(m, v, sizeof(m))
#define mp                  make_pair
#define pb                  push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;} 
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;} 

typedef long long ll;
typedef unsigned long long ull;

#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)

#ifdef _DEBUG
template<class _T>
inline void _prfe(const char *_n, _T _c, bool _p = false){
    ITER(_c) _it=_c.begin();
    if(_p){ cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<"    "<<*_it<<endl;cout<<"]"<<endl; }
    else{ cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif

int main(){
    int a[3], n, m;
    while(1){
        cin >> a[0] >> a[1] >> a[2];
        if(a[0] == 0 && a[1] == 0 && a[2] == 0) break;
        sort(a,a+3);
        cin >> n;
        double l1 = a[0]/2.0, l2 = a[1]/2.0;
        double r = sqrt(l1*l1+l2*l2);
        REP(i,n){
            cin >> m;
            puts((m > r)?"OK":"NA");
        }
    }

    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);
    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<cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    while(1){
        int a[3];
        scanf("%d %d %d",a,a+1,a+2);
        if (a[0]==0&&a[1]==0&&a[2]==0) return 0;
        sort(a, a+3);
        short l=sqrt(a[0]*a[0]+a[1]*a[1]);
        int n;
        scanf("%d",&n);
        for (int i=0; i<n; i++) {
            int r;
            scanf("%d",&r);
            if (2*r<=l) printf("NA\n");
            else printf("OK\n");
        }
    }
}

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(){
	stringstream buf;
	int a,b,c,n;
	scanf("%d %d %d %d",&a,&b,&c,&n);
	vector<int> args;
	args.push_back(a);
	args.push_back(b);
	args.push_back(c);
	sort(args.begin(),args.end());
	double d = sqrt(args[0]*args[0]+args[1]*args[1]);
	for(int x=0;x<n;++x){
		int r;
		scanf("%d",&r);
		double l = sqrt(2)*r;
		if(d<2*r){
			buf<<"OK\n";
		}else{
			buf<<"NA\n";
		}
	}
	scanf("%d %d %d",&a,&b,&c);
	cout<<buf.str();
	return 0;
}

C++: #include<iostream>
#include<math.h>

using namespace std;
int main()
{
	int n;
	double  a,x,y,z,r,i,j,rad;
	
	for(;;)
	{
		cin >> x >> y >> z;
		if(x==0 && y==0 && z==0)
			break;
		cin >> n;
		x/=2;
		y/=2;
		z/=2;
		if(x>y)
		{
			a=x;
			x=y;
			y=a;
		}
		if(x>z)
		{
			a=x;
			x=z;
			z=a;
		}
		if(y>z)
		{
			a=y;
			y=z;
			z=a;
		}
		if(x<y)
		{
			a=x;
			x=y;
			y=a;
		}
		for(i=0;i<n;i++)
		{
			cin >> r;
			if(sqrt(x*x+y*y)<r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
}

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

int main()
{
  int m[3];
  int n;

  while (cin >> m[0] >> m[1] >> m[2], m[0] || m[1] || m[2]){
    sort(m, m + 3);
    int S = m[0] * m[0] + m[1] * m[1];
    int n, num;
    cin >> n;
    while (n--){
      cin >> num;
      double size = num * num * M_PI;
      cout << (S < size ? "OK" : "NA") << endl;
    }
  }
  return (0);
}

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


using namespace std;

int main()
{
	int t[3];
	while (scanf("%d %d %d", t, t+1, t+2), t[0] | t[1] | t[2])
	{
		sort(t, t+3);
		double len = sqrt((double)t[0]*t[0]+t[1]*t[1]);
		int n;
		scanf("%d", &n);
		for (int i = 0; i < n; ++i)
		{
			int r;
			scanf("%d", &r);
			if (len < 2.0 * r)
				printf("OK\n");
			else
				printf("NA\n");
		}
	}

	return 0;
}