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<cmath>
#include<algorithm>
using namespace std;

double get_d(int a, int b, int c)
{
  int num[3];
  num[0] = a;
  num[1] = b;
  num[2] = c;
  sort(num, num + 3);
  return sqrt(pow(num[0], 2) + pow(num[1], 2));
}

int main()
{
  while(true)
  {
    int a, b, c, n;
    double d;
    cin >> a >> b >> c;
    if(!a && !b && !c)
      break;
    cin >> n;
    d = get_d(a, b, c);
    for(int i = 0; i < n; i++)
    {
      int r;
      cin >> r;
      cout << (r * 2 > d ? "OK" : "NA") << endl;
    }
  }
}

C++: #include<stdio.h>
#include<math.h>
#define M(a,b) (a<b?a: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(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;




int main(){
	vi v(3);
	int n,r;
	while(cin>>v[0]>>v[1]>>v[2]){
		if(v[0]==0&&v[1]==0&&v[2]==0)break;
		sort(all(v));
		int d=(v[0]*v[0]+v[1]*v[1]);
		cin>>n;
		rep(i,n){
			cin>>r;
			r*=r;
			r*=4;
			if(r>d)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

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

int main() {
  int x, y, z, n, r, a, b, c;

  while (1) {
    scanf("%d %d %d", &x, &y, &z);
    if (!x && !y && !z) break;
    scanf("%d", &n);
    if (x>y && x>z) {
      a = y;
      b = z;
    } else if (y>z) {
      a = z;
      b = x;
    } else {
      a = x;
      b = y;
    }
    c = floor(sqrt((a*a+b*b)*0.25))+1;
    for (int i=0; i<n; i++) {
      scanf("%d", &r);
      if (r < c) {
        printf("NA\n");
      } else {
        printf("OK\n");
      }
    }
  }

  return 0;
}

C++: // This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>

int main()
{
    while (true) {
        int d, w, h;
        std::cin >> d >> w >> h;
        if (d == 0 && w == 0 && h == 0) {
            break;
        }
        
        float dw_r, dh_r, wh_r;
        dw_r = std::sqrt(d * d + w * w) / 2.0f;
        dh_r = std::sqrt(d * d + h * h) / 2.0f;
        wh_r = std::sqrt(w * w + h * h) / 2.0f;
        
        int n;
        std::cin >> n;
        std::vector<int> r(n);
        for (int i = 0; i < n; i++) {
            std::cin >> r[i];
            if (dw_r < r[i] || dh_r < r[i] || wh_r < r[i]) {
                printf("OK\n");
            } else {
                printf("NA\n");
            }
        }
    }
    
    return 0;
}

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

using namespace std;

int CarryCheese(double, double, double);

int main(){
  int i, n, hole, result, data[3];

  while(1){
    for(i=0; i<3; ++i)
      cin >> data[i];
    if(data[0] == 0 && data[1] == 0 && data[2] == 0) break;

    sort(data, data+3);

    cin >> n;
    for(i=0; i<n; ++i){
      cin >> hole;
      result = CarryCheese(((double)data[0])/2, ((double)data[1])/2, (double)hole);
      if(result == 1)
	cout << "OK" << endl;
      else
	cout << "NA" << endl;
    }
  }

  return 0;
}


int CarryCheese(double x, double y, double h){
  if(x >= h)
    return 0;
  else if(y < sqrt(h*h - x*x))
    return 1;
  else
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
	double d,w,h,n,r,a,b,c,m;
	while(cin>>d>>w>>h,d!=0&&w!=0&&h!=0){
		a=sqrt(d*d+w*w);
        b=sqrt(d*d+h*h);
        c=sqrt(w*w+h*h);
		m=min(a,min(b,c));
		cin>>n;
		while(n--){
			cin>>r;
			r=r*2;
			if(m<r)cout<<"OK\n";
			else cout<<"NA\n";
		}
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;
typedef pair<int, int> P;

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

C++: #include<complex>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<deque>
#include<queue>
#include<climits>
#include<list>
#include<stack>
#include<ctime>
#define all(n) n.begin(),n.end()
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define INF (1<<27)
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef unsigned long long ull;
typedef long long ll;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};

class AOJ0107{
private:
  int w,d,h;
  double t_r,f_r,l_r;
public:
  AOJ0107(int w,int h,int d):w(w),h(h),d(d){
    t_r = sqrt(pow((double)w/2.0,2)+pow((double)h/2.0,2));
    f_r = sqrt(pow((double)h/2.0,2)+pow((double)d/2.0,2));  
    l_r = sqrt(pow((double)w/2.0,2)+pow((double)d/2.0,2));  
  }
  ~AOJ0107(){}

  bool judge(double sp){
    if(sp-t_r > EPS)return true;
    if(sp-f_r > EPS)return true;
    if(sp-l_r > EPS)return true;
    return false;
  }

  void run(){
    int cnt;
    cin >> cnt;
    rep(i,cnt){
      int rect;
      cin >> rect;
      if(judge(rect))cout << "OK" << endl;
      else cout << "NA" << endl;
    }

  }



};


int main(){

  while(true){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c == 0)break;
    AOJ0107 ans = AOJ0107(a,b,c);
    ans.run();
  }
return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	long long int n, r, d, w, h, x;
	while (1) {
		cin >> d >> w >> h;
		if (d + w + h == 0)
			return 0;
		if (d <= h && w <= h)
			x = d * d + w * w;
		else if (d <= w && h <= w)
			x = d * d + h * h;
		else if (w <= d && h <= d)
			x = w * w + h * h;
		cout << x;
		cin >> n;
		for (int lop = 0; lop < n; lop++) {
			cin >> r;
			if (4*r*r >= x)
				cout << "OK\n";
			else
				cout << "NA\n";
		}
	}
	return 0;
}