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<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

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

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

using namespace std;

string ans[11000];

int main(void) {
    int v[3], n, r;
    double w, h, l;
    
    while (scanf("%d %d %d", &v[0], &v[1], &v[2]), v[0]) {
        sort(v, v + 3);
        w = v[0] / 2.0;
        h = v[1] / 2.0;
        l = sqrt(w * w + h * h);
        scanf("%d", &n);

        for (int i = 0; i < n; i++) {
            scanf("%d", &r);
            if ((double)r > l) ans[i] = "OK";
            else ans[i] = "NA";
        }
        
        for (int i = 0; i < n; i++)
            cout << ans[i] << endl;
    }

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll d, w, h;
	while (cin >> d >> w >> h, d) {
		ll minr = min({ hypot(d,w),hypot(w,h),hypot(h,d) }) / 2;
		ll n = in();
		REP(i, n) {
			ll r = in();
			cout << (r > minr ? "OK" : "NA") << endl;
		}
	}
}

C++: #include <stdio.h>

int main(void){
  int d,w,h,t;
  int n;
  int r;

  while (scanf("%d%d%d", &d, &w, &h), d*w*h){
    //sort
    if (d>w){
      t=d;d=w;w=t;
    }
    if (w>h){
      t=w;w=h;h=t;
    }
    if (d>w){
      t=d;d=w;w=t;
    }

    scanf("%d", &n);
    for (int i=0; i<n; i++){
      scanf("%d",&r);
      if (d*d+w*w < 4*r*r){
	puts("OK");
      } else {
	puts("NA");
      }
    }
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int A,B,C,n,R;
	while(cin>>A>>B>>C,A+B+C){
		int t=min(A*A+B*B,min(B*B+C*C,C*C+A*A));
		cin>>n;
		while(n--){
			cin>>R;
			cout<<(t<4*R*R?"OK":"NA")<<endl;
		}
	}
}

C++: #include<iostream>

using namespace std;


int main(){

  int a,b,c,r,qua;

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

    if(a == 0 && b == 0 && c == 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++: #include <iostream>
using namespace std;

int main() {
  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<iostream>
int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"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;
	int a[3];
	vector<string> res;
	
	while(cin>>a[0]>>a[1]>>a[2]>>N&&a[0]!=0&&a[1]!=0&&a[2]!=0){
		sort(a,a+3);
		double bd=sqrt(a[1]*a[1]+a[0]*a[0]);
		double t;
		REP(i,N){
			cin>>t;
			if(t*2<=bd)cout<<"NA"<<endl;
			else cout<<"OK"<<endl;
		}
	}
	
	
	return 0;
}

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

int R_range(int d, int w, int h) {
  int a, b, r;
  priority_queue<int> Q;
  Q.push(d); Q.push(w); Q.push(h); Q.pop();
  a = Q.top(); Q.pop();
  b = Q.top();
  r = a * a + b * b ;
  return r / 4;
}

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

C++: #include<stdio.h>

int main(){

int x,y,z,N,r;
int n[1001]={};
while(1){
scanf("%d %d %d",&n[0],&n[1],&n[2]);if(n[0]==0&&n[1]==0&&n[2]==0)break;
for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

scanf("%d",&N);
for(int i=0;i<N;i++){

scanf("%d",&r);
if(n[1]>r*1.4141356)printf("NA\n");
else printf("OK\n");
}
}
return 0;
}