Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: // 2011/01/14 Tazoe

#include <iostream>
using namespace std;

void ABC_sort(int& A, int& B, int& C)
{
	int tmp[3] = {A, B, C};

	for(int i=0; i<2; i++)
		for(int j=i+1; j<3; j++)
			if(tmp[i]>tmp[j]){
				int swp = tmp[i];
				tmp[i] = tmp[j];
				tmp[j] = swp;
			}

	A = tmp[0];
	B = tmp[1];
	C = tmp[2];
}

int main()
{
	while(true){
		int A, B, C;
		cin >> A >> B >> C;
		if(A==0&&B==0&&C==0)
			break;

		ABC_sort(A, B, C);
		int D = A*A+B*B;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int R;
			cin >> R;
			if(D<4*R*R)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	double a, b, c, d;
	while(cin >> a >> b >> c, a){

		d = sqrt(pow(min(a, min(b, c)), 2) + pow(a + b + c - min(a, min(b,c)) - max(a, max(b, c)), 2));
	
		int n;
		cin >> n;
		while(n--){
			int r;
			cin >> r;
			if(d < 2 * r)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

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

int main(void)
{
	int a[3], n, b;
	while (scanf("%d %d %d", &a[0], &a[1], &a[2]), a[0]){
		sort(a, a + 3);
		int r = a[0]*a[0] + a[1]*a[1];
		cin >> n;
		for (int i = 0; i < n; i++){
			cin >> b;
			if (r < (b*2)*(b*2)) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	
	return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(){
	int d,w,h,r,n,rd;
	while(cin>>d>>w>>h){
		if(d==0&&w==0&&h==0)break;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r;
		rd=r*2;
		if(d<rd&&w<rd&&h<rd){
			cout<<"OK"<<endl;
			continue;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}

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

#include <iostream>
#include <cmath>
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 && x > b || x > b && x > c || x > c && x > a){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1e7
int main(){
    ll d,w,h;
    while(cin >> d >> w >> h,d+w+h){
        int n; cin>>n;
        vi v (n+1,0);
        double pi = acos(-1.0);
        ll s = w*h;
        rep(i,n){
            cin >>v[i];
            double temp = v[i]*v[i]*pi;
            int r = 2*v[i];
            //cout << "temp : " << temp << "s :" << s << endl;
            if( d<r && w<r && h<r  && temp>s)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
            }
        }
    return 0;
}

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

int main(){
	while(1){
		vector<int> 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++){
			int r;
			cin>>r;
			r=sqrt(2)*r;
			if(r>=x[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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

int main(void)
{
	int num,kosu;
	int nyuuryoku[3],x,y;
	int cut_i,cut_j,tem;
	int hankei;
	double z;

	while(1){
		scanf("%d%d%d",&nyuuryoku[0],&nyuuryoku[1],&nyuuryoku[2]);
		if((nyuuryoku[0]==0)&&(nyuuryoku[1]==0)&&(nyuuryoku[2]==0)){
			break;
		}

		for(cut_i=0;cut_i<kosu-1;cut_i++){
			for(cut_j=cut_i;cut_j<kosu;cut_j++){
				if(nyuuryoku[cut_i]>nyuuryoku[cut_j]){
					tem=nyuuryoku[cut_i];
					nyuuryoku[cut_i]=nyuuryoku[cut_j];
					nyuuryoku[cut_j]=tem;
				}
		    }
		}
		x=nyuuryoku[1];
		y=nyuuryoku[2];
		
		z = sqrt((double)(x*x) + (double)(y*y));

		scanf("%d",&kosu);
		
		for(cut_i=0;cut_i<kosu;cut_i++){
			scanf("%d",&hankei);
			if(z>=(double)hankei){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}

	}
	return 0;
}

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

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

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

double m[3];
void solve(){

}
int main(){
  while(cin >> m[0] >> m[1] >> m[2], m[0]||m[1]||m[2]){
    sort(m, m+3);
    double d = sqrt(m[0]*m[0]+m[1]*m[1]);
    int n;
    cin >> n;
    while(n--){
      double r;
      cin >> r;
      cout << (d<(r*2.)?"OK":"NA") << endl;
    }
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void)
{
  while(true) {
    int d[3];
    cin >> d[0] >> d[1] >> d[2];
    if(!d[0] && !d[1] && !d[2]) break;
    int n;
    cin >> n;

    sort(d, d+3);
    long double l = sqrt(d[0]*d[0]+d[1]*d[1]);
    REP(i, n) {
      int r;
      cin >> r;
      if(2*r > l) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }

  return 0;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	int h[3],r,n;
	double t;
	for(;;){
		rep(i,3)scanf("%d",h+i);
		sort(h,h+3);
		if(h[0]==0)break;
		t=(h[0]*h[0]+h[1]*h[1])/4.0;
		scanf("%d",&n);
		rep(i,n){
			scanf("%d",&r);
			puts(r*r>t?"OK":"NA");
		}
	}
	return 0;
}