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<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i=0;i<n;i++)
#define REP(i,s,n) for(long long i=(s);i<=(n);i++)
#define repr(i,n) for(long long i=n-1;i>=0;i--)
#define REPR(i,s,n) for(long long i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define sz(s) (long long)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
//const ll mod=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

void out(){cout << "\n";}
template<class T,class... Args>
void out(const T &x,const Args &... args){
	cout << x << " ";
	out(args...);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
	for(T& e: vec) is >> e;
	return is;
}

template<typename T>
string join(vector<T>& vec, string sep=" "){
	stringstream ss;
	for(int i=0;i<(int)vec.size();i++){
		ss << vec[i] << (i+1==(int)vec.size()?"\n":sep);
	}
	return ss.str();
}

template<class T>
inline bool chmax(T& a, T b){if(a<b){a=b;return true;} return false;}

template<class T>
inline bool chmin(T& a, T b){if(a>b){a=b;return true;} return false;}

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll invmod(ll a){ return powmod(a,mod-2); }
ll nCrmod(ll n,ll r){ll x=1,y=1; for(ll i=0;i<r;i++) {x=x*(n-i)%mod; y=y*(i+1)%mod; } return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	while(1){
		double d,w,h;
		cin >> d >> w >> h;
		if(!d && !w && !h) break;
		ll n;
		cin >> n;
		rep(i,n){
			double r;
			cin >> r;
			bool frag=false;
			if(sqrt(d*d+w*w)<2*r || sqrt(d*d+h*h)<2*r || sqrt(h*h+w*w)<2*r) frag=true;
			if(frag) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){

  int t,y,h,k,i,n,r;
  double c;
  while(cin>>t>>y>>h){
    if(t==0&&y==0&&h==0)break;
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    if(y<h){
      n=t;
      t=y;
      y=n;
    }
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    c=sqrt((t/2)*(t/2)+(y/2)*(y/2));
    cin>>k;
    for(i=0;i<k;i++){
      cin>>r;
      if(r>c){
	cout<<"OK"<<endl;
      }
      else{
	cout<<"NA"<<endl;
      }
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<math.h>
#define M(a,b) (a<b?a:b)
#define S(a,b) sqrt(a*a+b*b)
int main(){
	for(int a,b,c,n,r;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2*r>M(M(S(a,b),S(b,c)),S(c,a)))?
				"OK":"NA"
			);
		}
	}
}

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

int main(){

  int cheeze[3], n, r, hole;
  double d;

  while(cin >> cheeze[0] >> cheeze[1] >> cheeze[2]){
    if(cheeze[0] == 0) break;
    cin >> n;

    sort(cheeze, cheeze+3);
    r = cheeze[0] * cheeze[0] + cheeze[1] * cheeze[1];
    d = (double)cheeze[0] * cheeze[1];
    d = d * d / r;

    for(int i=0; i<n; i++){
      cin >> hole;
      if(4 * hole * hole > r && (double)hole * hole > d) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }

  return 0;

}

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

using namespace std;

int main() {

	double 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(c[0], 2)+pow(c[1], 2));

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

	return 0;

}

C++: #include <iostream>
#include <string>
#define MAX 10000
using namespace std;



int main(void){

  
  int  a ,b, h , n , hankei[MAX] , r[MAX] , nagai1 = MAX ,nagai2 = MAX;
  
  string hantei[MAX];
  

  while(1){

    cin >> a >> b >> h ;

 
    if( nagai1 > a ){

      nagai1 = a;
      nagai2 = a;
    }

    if(nagai1 >= b > nagai2 ){

      nagai1 = b;
      
    }

    else if( b <=  nagai2) nagai2 = b;

    if( nagai1 >= h > nagai2){

      nagai1 = h;

    }

    else if( h <= nagai2 ) nagai2 = h; 



    if ( a == 0 && b == 0 && h ==0) break;


    cin >> n;


    for ( int i = 0 ; i < n ; i ++){


    
      cin >> r[i] ;


      // テδづつセテδεつイテδづつキテδεつッテδ暗つステδεつδεつェテδづつ、テδ偲つキテδ療つサテδづつサ

      if ( nagai1 * nagai1 + nagai2 * nagai2  < 4 * r[i] * r[i]  ) hantei[i] = "OK";
      

 


      else hantei[i] = "NA";



      

      //

      cout << hantei[i] << endl ;

    }


      

  }


  return 0;

}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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

C++: #include <iostream>
#include <math.h>
#define MAX_N 100000
using namespace std;
int n,m=0,r;
double d,w,h,minl; 
int main(){
	while(1){
		cin >> d>> w>> h;
		if(d==0 && w==0 && h==0)break;

		minl=MAX_N;
		if(sqrt(d*d+w*w)<minl)minl=sqrt(d*d+w*w);
		if(sqrt(h*h+w*w)<minl)minl=sqrt(h*h+w*w);
		if(sqrt(d*d+h*h)<minl)minl=sqrt(d*d+h*h);
		cin >> n;
		m=n;
		while(n--){
			cin >> r;
			if(2*r>minl){
				cout << "OK"<<endl;
			}else{
				cout << "NA"<<endl;
			}
		}
	}
	return 0;
}