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<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;

void sorting(int *a,int *b,int *c){
	vector<int> args;
	args.push_back(*a);
	args.push_back(*b);
	args.push_back(*c);
	sort(args.begin(),args.end());
	*a = args[0];
	*b = args[1];
	*c = args[2];
}

int main(){
	stringstream buf;
	int a,b,c;
	string line;
	getline(cin,line);
	sscanf(line.c_str(),"%d %d %d",&a,&b,&c);
	sorting(&a,&b,&c);
	getline(cin,line);
	getline(cin,line);
	while(line!="0 0 0"){
		int n;
		sscanf(line.c_str(),"%d",&n);
		double l = sqrt(2)*n;
		if(l>=a && l>=b){
			buf<<"OK\n";
		}else{
			buf<<"NA\n";
		}
		getline(cin,line);
	}
	cout<<buf.str();
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)

bool isinside(int x, int y, int r){
    return ( x*x + y*y < 4*r*r );
}

int main(){
    int tate,yoko,high,n,r,i;

    while( cin >> tate >> yoko >> high, tate|yoko|high ){
        cin >> n;
        rep(i,n){
            cin >> r;
            if( isinside(tate,yoko,r) || isinside(tate,high,r) || isinside(yoko,high,r) ){
                puts("OK");
            }
            else{
                puts("NA");
            }
        }
    }

    return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int a,b,c;
while(cin>>a>>b>>c,a||b||c){
vector<int>in;
pb(in,a);
pb(in,b);
pb(in,c);
sort(all(in));
int n;
cin>>n;
rep(i,n){
int a;
cin>>a;
if(a>hypot(in[0]/2,in[1]/2))cout<<"OK"<<endl;
else cout<<"NA"<<endl;
}
}
}

C++: #include "bits/stdc++.h"
using namespace std;

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

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

using namespace std;

int main(int argc, char *argv[]) {
  int size[3];
  while (true) {
    cin >> size[0] >> size[1] >> size[2];
    if (size[0] == 0 && size[1] == 0 && size[2] == 0)
      break;
    sort(size+0, size+3);
    double a = size[0], b = size[1];
    double hoge = sqrt(a * a + b * b);
    int n, r;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> r;
      if (r * 2 > hoge)
        cout << "OK" << endl;
      else
        cout << "NA" << endl;
    }
  }
  return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

ll x, y, z;
int n;
ll r;

inline bool check(ll x, ll y){ return x * x + y * y < 4 * r * r; }

int main()
{
  while(~scanf(" %lld %lld %lld", &x, &y, &z) && x && y && z){
    scanf(" %d", &n);
    while(n--){
      scanf(" %lld", &r);
      bool ok = false;
      ok |= check(x, y) | check(y, z) | check(z, x);
      puts(ok ? "OK" : "NA");
    }
  }

  return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>


using namespace std;


#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(a,b) make_pair((a),(b))

int main(){
	int h, w, f, n, t, r;
	while(cin>>h>>w>>f,h||w||f){
		cin>>n;
		if(max({h,w,f})==f){
			t=h*h+w*w;
		}else if(max({h,w,f})==w){
			t=h*h+f*f;
		}else{
			t=w*w+f*f;
		}
		rep(i,n){
			cin>>r;
			if(4*r*r>t){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while (1) {

		vector<long long int>ls(3);
		cin >> ls[0] >> ls[1] >> ls[2];
		sort(ls.begin(), ls.end());
		long long int r = (ls[0] * ls[0] + ls[1] * ls[1]);
		if (!ls[0])break;
		long long int d; cin >> d;
		while (d--) {
			long long int n; cin >> n;
			if (4*n*n<=r)cout << "OK" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(void){

  int a[3];
  while( cin >> a[0] >> a[1] >> a[2] , ( a[0] || a[1] || a[2] ) ){
    
    int n;
    cin >> n;
    sort( a , a + 3 );
    int R = a[0]*a[0] + a[1]*a[1];

    while(n--){
      int r;
      cin >> r;
      if( 2 * r > sqrt(R) ) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
  return 0;
}

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

using namespace std;

int main(void) {
	int size[3];

	while (cin >> size[0] >> size[1] >> size[2]) {
		if (size[0] == 0 && size[1] == 0 && size[2] == 0) {
			break;
		}
		std::sort(size, size + 3);

		// 直方体の最小面の対角線
		double diagonal = sqrt(pow(size[0], 2) + pow(size[1], 2));
		int num_entries, r;

		cin >> num_entries;

		for (int i = 0; i < num_entries; i++) {
			cin >> r;
			cout << (r * 2 >= diagonal ? "OK" : "NA") << endl;
		}
	}
}