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

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

int main(){
	int x,y,z;
	while(1){
		cin>>x>>y>>z;
		if(x==0 && y==0 &&z==0)return 0;
		int dia[3];
		dia[0]=hypot(x,y)/2;
		dia[1]=hypot(y,z)/2;
		dia[2]=hypot(z,x)/2;
		int n;
		cin>>n;
		for(int i=0;i<n;i++){
			int r;
			cin>>r;
			if(r>dia[0] || r>dia[1] || r>dia[2]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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;
	long a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	long bd=a[0]*a[0]+a[1]*a[1];
	int cnt=0;
	while(cnt<N){
		long t;
		cin>>t;
		if(t*t*4>bd)res.PB("OK");
		else res.PB("NA");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

C++: #include <iostream>

using namespace std;
/** Problem0107 : Carry a Cheese **/
int main()
{
	int x, y, z, r, n;
	
	while (1) {
		cin >> x >> y >> z;
		if (x == 0 && y == 0 && z==0)
			break;
	
		cin >> n;
		for (int i=0; i<n; i++) {
			cin >> r;
			if (2*r*2*r > x*x+y*y || 4*r*r > x*x+z*z || 4*r*r > y*y+z*z)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

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

double minDiagonal(int a, int b, int c) {
    if (a >= b && a >= c) {
        return sqrt(b * b + c * c);
    } else if (b >= a && b >= c) {
        return sqrt(a * a + c * c);
    } else {
        return sqrt(a * a + b * b);
    }
}

int main() {
    while (true) {
        int a, b, c;
        cin >> a >> b >> c;
        if (a == 0 && b == 0 && c == 0) {
            break;
        }
        double diagonal = minDiagonal(a, b, c);
        int n;
        cin >> n;
        for (int i = 0; i < n; i++) {
            int radius;
            cin >> radius;
            if (diagonal < radius * 2) {
                cout << "OK" << endl;
            } else {
                cout << "NA" << endl;
            }
        }
    }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, c, n;
	float tmp;
	
	while(1){
		cin >> a >> b >> c;
		if(a == 0){
			break;
		}
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> tmp;
			tmp = tmp*tmp*3.1415/2.0;
			if(tmp > a*b || tmp > b*c || tmp > c*a){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

C++: #include <stdio.h>
int main(){
    int a,temp,n;
    while(1){
        scanf("%d",&a);
        if(a==0)return 0;
        for(int i=0;i<2;i++){
            scanf("%d",&temp);
            if(temp<a)a=temp;
        }
        scanf("%d",&temp);
        for(int i=0;i<temp;i++){
            scanf("%d",&n);
            if(n>=a)printf("OK\n");
            else printf("NA\n");
        }
        
    }
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  long ver,hor,height;
  while(1){
    cin>>ver>>hor>>height;
    if(!ver && !hor && !height)break;
    int n;
    int dis[3];
    dis[0]=sqrt(ver*ver+hor*hor);
    dis[1]=sqrt(hor*hor+height*height);
    dis[2]=sqrt(height*height+ver*ver);
    cin>>n;
    rep(i,n){
      int r;
      cin>>r;
      int cnt=0;
      rep(i,3){
	if(2*r>dis[i])cnt++;
      }
      if(cnt==0)cout<<"NA"<<endl;
      else cout<<"OK"<<endl;
    }
  }
  return 0;
}

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

using namespace std;

int main(){
	while(true){
		vector<int> size(3);
		cin >> size[0] >> size[1] >> size[2];
		if(size[0] == 0 && size[1] == 0 && size[2] == 0){ break; }
		sort(size.begin(), size.end());
		int n;
		cin >> n;
		while(n--){
			int r;
			cin >> r;
			if(4 * r * r > size[0] * size[0] + size[1] * size[1]){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

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