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 _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
	double d,w,h;
	while(~scanf("%lf %lf %lf",&d,&w,&h)){
		if(d==w && w==h && h==0) break;
		int n;
		scanf("%d",&n);
		for(int i=0;i<n;i++){
			double r;
			scanf("%lf",&r);
			if((d/2.0)*(d/2.0) + (h/2.0)*(h/2.0) < r*r
				|| (d/2.0)*(d/2.0) + (w/2.0)*(w/2.0) < r*r
				|| (w/2.0)*(w/2.0) + (h/2.0)*(h/2.0) < r*r)
			{
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}
	}
}

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(){
	vector<int> args(3);
	while(cin>>args[0]>>args[1]>>args[2], args[0]||args[1]||args[2]){
		sort(args.begin(),args.end());
		int n;
		cin>>n;
		//double d  = args[0]*args[0] + args[1]*args[1];
		//cout<<args[0]<<":"<<args[1]<<endl;
		for(int x=0;x<n;++x){
			int r;
			cin>>r;
			double l = sqrt(2)*r;
			//if(4*r*r>d){
			if(l>(double)args[0] && l>(double)args[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main(void){
  int x,y,z,n,r;

  while(cin >> x >> y >> z,x|y|z){

    double a,b,c;
    a=sqrt(x*x+y*y);
    b=sqrt(y*y+z*z);
    c=sqrt(z*z+x*x);
    
    cin >> n;
    while(n--){
      cin >> r;
      r*=2;
      if(r>a||r>b||r>c)cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}

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

int main(){
	int data[3];
	while(std::cin>>data[0]>>data[1]>>data[2],data[0],data[1],data[2]){
		int n;
		double min;
		std::sort(data,data+3);
		std::cin>>n;
		min=sqrt(data[0]*data[0]+data[1]*data[1])/2;
		for(int i=0,r;i<n;i++){
			std::cin>>r;
			if(r>min)std::cout<<"OK"<<std::endl;
			else std::cout<<"NA"<<std::endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<math.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    double x[3];
    int n;
    double e;

    while(cin >> x[0] >> x[1] >> x[2], x[2]){
        sort(x, x + 3);
        cin >> n;
        rep(i,n){
            cin >> e;
            if( sqrt(x[0] * x[0] + x[1] * x[1]) < 2 * e ){
                cout << "OK" << endl;
            }else{
                cout << "NA" << endl;
            }
        }

    }
}

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

int main()
{
	double x,y,z;
	while(cin >> x >> y >> z){
		double r = min(sqrt(x*x+y*y),min(sqrt(y*y+z*z),sqrt(z*z+y*y)));
		if(!r)
			break;
		int n;
		cin >> n;
		for(int i=0;i<n;i++){
			double R;
			cin >> R;
			R += R;
			if(R > r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

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

    return 0;
}

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

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

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

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

int main(){

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

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

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

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

  return 0;

}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  //std::cin >> x;
  //size[0] = x;
  //std::cin >> x;
  //size[1] = x;
  //std::cin >> x;
  //size[2] = x;
  //std::sort(size.begin(), size.end());
  
  //while(size[0]==0 && size[1]==0 && size[2]==0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std::cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
    //std::cin >> x;
    //size[0] = x;
    //std::cin >> x;
    //size[1] = x;
    //std::cin >> x;
    //size[2] = x;
    //std::sort(size.begin(), size.end());
  //}
  
  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n,r;
vi d(3);

int main(){
	while(1){
		cin>>d[0]>>d[1]>>d[2];
		if(d[0]+d[1]+d[2]==0) break;
		sort(d.begin(),d.end());
		double tmp=(double)sqrt(d[0]*d[0]+d[1]*d[1]);
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>r;
			if(2*r>tmp) cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}