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<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define EPS 1e-9
using namespace std;
typedef long long ll;
typedef pair<string, int>P;

int main() {
	double d, w, h;
	while (cin >> d >> w >> h, d) {
		double n; cin >> n;
		rep(i, n) {
			int r; cin >> r;
			if (r*2 > sqrt(d*d + w*w) || r*2 > sqrt(d*d + h*h) || r*2 > sqrt(w*w + h*h))
				puts("OK");
			else puts("NA");
		}
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int a[3]; cin >> a[0] >> a[1] >> a[2] && a[0];) {
		int n; cin >> n;
		sort(a, a + 3);
		rep(i, 0, n) {
			int r; cin >> r;
			if (r*r * 4 > a[0] * a[0] + a[1] * a[1])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return 0;
}

C++: //40
#include<iostream>
#include<algorithm>

#define S(X) ((X)*(X))

using namespace std;

int main(){
  for(int l[3];cin>>l[0]>>l[1]>>l[2],l[0]|l[1]|l[2];){
    sort(l,l+3);
    int n;
    cin>>n;
    while(n--){
      int r;
      cin>>r;
      cout<<((S(l[0])+S(l[1])<S(2*r))?"OK":"NA")<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e4;

int main()
{
	lld d,w,h,n;
	double r[MAXN] = {0};

	cin >> d >> w >> h;
	if (d == 0 && w == 0 && h == 0)
	{
		return 0;
	}

	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> r[i];
	}

	double di[3] = {sqrt(d*d + w*w), sqrt(w*w + h*h), sqrt(h*h + d*d)};

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			if (2*r[i] > di[j])
			{
				cout << "OK" << endl;
				break;
			}

			if (j == 2)
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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));
		double d=0.250*(v[0]*v[0]+v[1]*v[1]);
		cin>>n;
		rep(i,n){
			cin>>r;
			r*=r;
			if(r>d)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

C++: #include<bits/stdc++.h>
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);

    while( n-- ) {
      int r;
      cin >> r;
      if( sqrt(d[0]*d[0] + d[1]*d[1]) < 2*r ) cout << "OK" << endl;
      else cout << "NA" << endl;
    }

  }

}

C++: #include <algorithm>
#include <cstdio>

using namespace std;

int main() {
  while (true) {
    int size[3];
    scanf("%d %d %d", size, size + 1, size + 2);
    if (size[0] == 0 && size[1] == 0 && size[2] == 0) { break; }
    sort(size, size + 3);
    int squared_chord = size[0] * size[0] + size[1] * size[1];

    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
      int radius;
      scanf("%d", &radius);
      int squared_diameter = 4 * radius * radius;
      puts(squared_diameter > squared_chord ? "OK" : "NA");
    }
  }

  return 0;
}

C++: #include <stdio.h>
#include <math.h>
int main(void)
{
  int i;
  double temp;
  double x[3];
  int y, z;
  int n;
  double t;

  while(1){
    for(i=0; i<3; i++)
      scanf("%d", &x[i]);
    if(x[0]==0)
      return 0;
      
    if(x[0]>x[1]){
      temp=x[0];
      x[0]=x[1];
      x[1]=x[0];
    }

    if(x[1]>x[2]){
      temp=x[1];
      x[1]=x[2];
      x[2]=x[1];
    }   
    if(x[0]>x[2]){
      temp=x[0];
      x[0]=x[2];
      x[2]=x[0];
    }
  
  t=x[0]*x[0]+x[1]*x[1];
  t=sqrt(t);
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    scanf("%d", &y);
    
    if(2*y>t)
      printf("OK\n");
    else
      printf("NA\n");
    
  }
  }
  return 0;
}

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

int main(){
	int a,b,c,n,r,R;
	while( cin >> a >> b >> c , a || b || c ){
		cin >> n;
		for(int i=0 ; i < n ; i++ ){
			bool ans = true;
			cin >> r;
			R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
			if( 2*r <= R ) ans = false;
			cout << (ans?"OK":"NA") << endl;
		}
	}
}

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

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int main()
 {
   int A,B,C;
   while(cin>>A>>B>>C)
   {
     if(A==0&&B==0&&C==0) break;
     int num;
     int a=A*A+B*B;
     int b=A*A+C*C;
     int c=B*B+C*C;
     double kk=min(a,min(b,c));
     kk=sqrt(1.0/4*kk); 
     cin>>num;
     while(num--)      
     {
       int n;
       cin>>n;
       if(n>kk) cout<<"OK"<<endl;
       else cout<<"NA"<<endl;                  
     }             
   }
   //while(1);
   return 0;
 }

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;

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