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++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#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())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	LL a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	double bd=sqrt(a[1]*a[1]+a[0]*a[0]);
	int cnt=0;
	while(cnt<N){
		double t;
		cin>>t;
		if(t*2<=bd)cout<<"NA"<<endl;
		else cout<<"OK"<<endl;
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	
	return 0;
}

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

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		vector<int>s{ a,b,c };
		if (!a && !b && !c)break;
		sort(s.begin(), s.end());
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			int f;
			cin >> f;
			if (f*2>s[2])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

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

#define EPS 1e-8

int n;
double r;
double ls[3];

int main() {
  while (1) {
    for (int i=0; i<3; i++) scanf("%lf", &ls[i]);
    if (ls[0] == 0.0) return 0;
  
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
      scanf("%lf", &r);
  
      bool found = false;
      for (int i=0; i<3; i++) {
        double d = ls[i]/2;
        if (2*sqrt(r*r-d*d)-EPS > ls[(i+1)%2]) {
          found = true;
          break;
        }
      }
  
      if (found) puts("OK");
      else puts("NA");
    }
  }
}

C++: #include <stdio.h>

#define SQ(x) ((x) * (x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))

int main(void)
{
	int len, wid, hite;
	int r;
	int n;
	
	while (1){
		int couch;
		scanf("%d%d%d", &len, &wid, &hite);
		
		if (len == 0){
			break;
		}
		
		couch = MIN(SQ(len) + SQ(wid), MIN(SQ(len) + SQ(hite), SQ(wid) + SQ(hite)));
		
		scanf("%d", &n);
		
		for (int i = 0; i < n; i++){
			scanf("%d", &r);
			
			if (couch < SQ(2 * r)){
				puts("OK");
			}
			else {
				puts("NA");
			}
		}
	}
	
	return (0);
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime> 

using namespace std;

bool check(double x,double y,double z,double r){  
	return sqrt(x*x+y*y) < r*2;
}  
int main(){  
	int data[3],r,n;
	while(cin >> data[0] >> data[1] >> data[2],data[0]){      
		cin >> n;    
		for(int i=0;i<n;i++){        
			cin >> r;    
			bool ret = false; 
			sort(data,data+3);      
			do{         
				ret |= check(data[0],data[1],data[2],r);     
			}
			while(next_permutation(data,data+3));   
			cout << (ret?"OK":"NA") << endl; 
		} 
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		int d[3]={},n,r;
		rep(i,0,3) cin>>d[i];
		if(d[0]==0&&d[1]==0&&d[2]==0) break;
		sort(d,d+3);
		double l;
		l=pow(d[0]*d[0]+d[1]*d[1],0.5)*0.5;
		cin>>n;
		rep(i,0,n){
			cin>>r;
			o((l<r?"OK":"NA"));
		}
	}
}

C++: #include<iostream>

using namespace std;


int main(){

  int a,b,c,r,qua;

  while(1){
    cin >> a >> b >> c;

    if(a == 0) break;

    cin >> qua;

    for(int i = 0; i < qua; i++){
      cin >> r;

      if(a < 2*r && b < 2*r && c < 2*r) cout << "OK"<<endl;
      else cout << "NA"<<endl;

    }


  }

  return 0;
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

int main()
{
	long long int a[3];
	while (1)
	{
		for (size_t i = 0; i < 3; i++)
		{
			cin >> a[i];
		}
		if (!a[0])break;
		sort(a, a + 3);
		a[2] = a[0] * a[0] + a[1] * a[1];
		int N;
		cin >> N;
		long long int x;
		for (size_t i = 0; i < N; i++)
		{
			cin >> x;
			x *= 2;
			if (x*x>a[2])
			{
				cout << "OK" << endl;
			} else
			{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}