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
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {

	while (true) {
		VI c(3); rep(i, 3)cin >> c[i];
		if (c[0] == 0 && c[1] == 0 && c[2] == 0)break;

		sort(all(c));
		double max = hypot((double)c[0] / 2., (double)c[1] / 2.);
		
		int n; cin >> n;
		rep(i, n) {
			double r; cin >> r;
			puts(r > max ? "OK" : "NA");
		}
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int edge[3];
  while(cin >>edge[0]>>edge[1]>>edge[2],edge[0]||edge[1]||edge[2]){
    int n;
    cin >>n;
    sort(edge,edge+2);
    while(n--){
      int x;
      cin >>x;
      if(edge[0]*edge[0]+edge[1]*edge[1]<x*x*4){cout <<"OK"<<endl;}
      else{cout <<"NA"<<endl;}
    }
  }
  return 0;
}

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

int main() {
	int d[3];
	while (cin >> d[0] >> d[1] >> d[2], d[0], d[1], d[2]) {
		int n;
		cin >> n;
		sort(d, d + 3);
		double c = sqrt(d[0] * d[0] + (d[1] * d[1]));
		for (int i = 0;i < n;i++) {
			int a;
			cin >> a;
			if (a*2 > c)cout << "OK" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

double f(int a, int b){ return sqrt(a*a + b*b) / 2.0; }

int main(){
  int x,y,z;
  while(cin>>x>>y>>z, x+y+z){
    double m = 1e10;
    m = min(m, f(x,y));
    m = min(m, f(y,z));
    m = min(m, f(x,z));
    //printf("m = %f\n",m);
    int n; cin>>n;
    while(n --> 0){
      double r; cin >> r;
      puts(r > m ? "OK" : "NA");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int a, b, c;
	while(cin >> a >> b >> c, a+b+c){
		if(a > b){
			swap(a, b);
		}
		if(b > c){
			swap(b, c);
		}
		int n;
		cin >> n;
		int size_sq = a*a+b*b;
		while(n--){
			int r;
			cin >> r; 
			if(4*r*r > size_sq){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	vector<double> v;
	int a[3];
	while(true)
	{
		cin >> a[0] >> a[1] >> a[2];
		if(a[0] == 0 && a[1] == 0 && a[2] == 0)
		{
			break;
		}

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		double dis = sqrt(v[0]*v[0] + v[1]*v[1]);
		dis /= 2;

		int n;
		cin >> n;

		while(n--)
		{
			double r;
			cin >> r;

			if(dis < r)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}

		}
	}
	return 0;
}

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

C++: #include <iostream>

using namespace std;

typedef long long ll;

int main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		ll v = -max( max(a * a, b * b), c * c ) + a * a + b * b + c * c;
		int n; cin >> n;
		for (int i = 0; i < n; ++i) {
			ll r; cin >> r;
			r *= 2;
			r *= r;
			if (r > v) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#define eps 1e-10
using namespace std;

int main() {
	int a, b, c, n, r;
	while(1){
		cin >> a >> b >> c;
		if(a == 0 && b == 0 && c == 0){
			break;
		}
		cin >> n;
		while(n--){
			cin >> r;
			double x = sqrt(2.0) * r;
			if(x - a + eps > 0 && x - b + eps > 0 || x - b + eps > 0 && x - c + eps > 0 || x - c + eps > 0 && x - a + eps > 0){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  double x,y,t;
  int r;
  int n;
  while(1){
    cin >> x >> y >> t;
    if(x==0 && y==0 && t==0)break;
    cin >> n;
    for(int i=0;i<n;i++){
      cin >> r;
      if(x/2<r && y/2<r && t/2<r){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}

C++: #include <stdio.h>
#include <stdlib.h>

void judge(int x, int y, int z, int r);

int main(void)
{
    int cheese_x, cheese_y, cheese_z;
    scanf("%d", &cheese_x);
    scanf("%d", &cheese_y);
    scanf("%d", &cheese_z);
    int n;
    int cnt;
    scanf("%d", &n);
    for(cnt = 0; cnt < n; cnt++){
        int hole_size;
        scanf("%d", &hole_size);
        judge(cheese_x, cheese_y, cheese_z, hole_size);
    }
    return 0;
}

void judge(int x, int y, int z, int r)
{
    int d_1, d_2, d_3;
    d_1 = (x / 2) * (x / 2) + y * y;
    d_2 = (y / 2) * (y / 2) + z * z;
    d_3 = (z / 2) * (z / 2) + x * x;
    if(d_1 < r || d_2 < r || d_3 < r){
        printf("OK\n");
    } else {
        printf("NA\n");
    }
}