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 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, v;
	while (cin >> x >> y >> z&&(x||y||z)) {
		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 (v > r*sqrt(2.0))
				cout << "NA" << endl;
			else
				cout << "OK" << endl;
		}
	}
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){

  int d,w,h;

  while(cin>>d>>w>>h,d||w||h){
	int n,r;
	cin>>n;

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

	  if(2*r > sqrt(d*d + h*h) || 2*r > sqrt(h*h + w*w) || sqrt(2*r > d*d + w*w))
		cout<<"OK"<<endl;
	  else
		cout<<"NA"<<endl;
		
	}
	
  }
  
}

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

int main(){
    double tmp[3],a,b,mini,n;
    while(true){
        for(int i=0;i<3;i++){
            cin >> tmp[i];
            if(tmp[2] == 0 && tmp[1] == 0 && tmp[2] == 0) return 0;
        }
        sort(tmp,tmp+3); a = tmp[0]; b = tmp[1];
        mini = sqrt(a*a+b*b);
        cin >> n;
        while(n--){
            cin >> a;
            cout << ((a*2 > mini)? "OK" : "NA") << endl;
        }
    }
}

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

int main(){
	int s1,s2,b;
	while(cin >> s1 >> s2 >> b){
		if(s1 == 0 && s2 == 0 && b == 0) break;
		
		if(s1 >= s2) swap(s1,s2);
		if(s2 >= 	b) swap(s2,b);
		int n;
		cin >> n;
		for(int i = 0; i < n; i++){
			int r;
			cin >> r;
		 if(sqrt(s1*s1 + s2*s2) >= r*2) cout << "NA" << endl;
			else cout << "OK" << endl;
		}
	}
}

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

using namespace std;

int main(){
	int x[3];
	int num,hole;
	while(cin >> x[0] >> x[1] >> x[2]){
		if(x[0]+x[1]+x[2] == 0) break;
		sort(x,x+3);
//		cout << x[0];

		cin >> num;
		for(int i=0;i<num;i++){
			cin >> hole;
			if((4 * hole* hole) > (x[0] * x[0] + x[1] * x[1])){
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}
	}
}

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

int main(){
	int h,w,d,n,a;
	while(cin >> h >> w >> d,h){
		cin >> n;
		for(int i = 0;i < n;++i){
			cin >> a;
			a *= 2;
			if((a * a > w * w + d * d) || (a * a > h * h + w * w) || (a * a > h * h + d * d)){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <algorithm>
#include <cstdio>

using namespace std;

int main() {
  int size[3];
  scanf("%d %d %d", size, size + 1, size + 2);
  sort(size, size + 3);
  int squared_chord = size[0] * size[0] + size[1] * size[1];

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int radius;
    scanf("%d", &radius);
    int diameter = radius * 2;
    puts((diameter * diameter > squared_chord) ? "OK" : "NA");
  }

  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>


using namespace std;

void Solution()
{
    int l, w, h;
    
    while (cin>>l>>w>>h, l) //when l or w or h = 0 it shoud be break
    {
        int n;
        
        cin>>n;
        
        while (n--)
        {
            int r;
            
            cin>>r;
            
            r *= 2;
            
            if((r * r > w * w + h * h) || (r * r > l * l + w * w) || (r * r > l * l + h * h))
            {
                cout<<"OK"<<endl;
            }
            else
            {
                cout<<"NA"<<endl;
            }
        }
    }

}

int main()
{
    Solution();
    return 0;
}

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

int main(){

  double a[5],d,c;
  int n;

  while(cin >> a[0] >> a[1] >> a[2], a[0], a[1], a[2]){
    cin >> n;

    sort(a,a+3);

    c = sqrt(a[0]*a[0] + a[1]*a[1]);

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

      if(2*d < c) cout << "NA" << endl;
      else cout << "OK" << endl;

    }
  }
}

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)res.PB("NA");
		else res.PB("OK");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a[3],n,i=0,r;
	cin>>a[0]>>a[1]>>a[2];
	if(!a[0])return 0;
	cin>>n;
	sort(a,a+3);
	cout<<a[0]*a[0]+a[1]/2*a[1]/2<<endl;
	for(;i<n;i++){
		cin>>r;
		cout<<((a[0]*a[0]+a[1]*a[1]<4*r*r)?"OK":"NA")<<endl;
	}
}