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

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

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

int main(){
	while(1){
		int a[3], n;
		for(int i=0; i<3; ++i) scanf(" %d", &a[i]);
		sort(a, a+3);
		if(a[2]==0) break;
		
		scanf(" %d", &n);
		for(int i=0; i<n; ++i){
			int r;
			scanf(" %d", &r);
	
			if(a[0]*a[0]+a[1]*a[1]<4*r*r) printf("OK\n");
			else printf("NA\n");
		}	
	}

	return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	while(true){
		ll d=in(),w=in(),h=in();
		if(!d && !w && !h) break;
		ll minA=min({d*d+w*w,w*w+h*h,h*h+d*d});
		int N=in();
		LOOP(N){
			int R=in();
			if(4*R*R>minA) out("OK");
			else out("NA");
		}
	}
	return 0;
}

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

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	for(;;){
		int length[3];
		rep(i, 3)
			scanf("%d", &length[i]);
		if(length[0]+length[1]+length[2] == 0)
			break;
		sort(length, length+3);
		int l = length[0]*length[0] + length[1]*length[1];

		int n;
		scanf("%d", &n);
		rep(i, n){
			int r;
			scanf("%d", &r);
			puts(r*r*4>l ? "OK" : "NA");
		}
	}
	return 0;
}

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

using namespace std;

int main(){

  int d, w, h;
  int n;
  int i;
  int tmp;
  int tmp_1, tmp_2;

  while(1){
    cin >> d >> w >> h;

    if(d==0 && w==0 & h==0)
      break;
    
    cin >> n;

    int r[n];

    if(d<=w && d<=h){
      tmp_1=d*d;
      if(w<=h){
	tmp_2=w*w;
      } else {
	tmp_2=h*h;
      }
    } else {
      tmp_1=w*w;
      tmp_2=h*h;
    }
       
    tmp=tmp_1+tmp_2;
    tmp=sqrt(tmp);
    tmp/=2;

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

    for(i=0;i<n;i++){
      if(r[i]>tmp){
	cout<< "OK" << endl;
      } else {
	cout<< "NA" << endl;
      }
    }
  }
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

		sort(a.begin(),a.end());
		int d = a[0]*a[0] + a[1]*a[1];

		int n;
		cin >> n;
		rep(i,n)
		{
			int r;
			cin >> r;

			if(d < (r*2)*(r*2))
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#define MAX 10000
using namespace std;



int main(void){

  
  int  a ,b, h , n , hankei[MAX] , r[MAX] , nagai1 = 0 ,nagai2 = 0 ;
  
  string hantei[MAX];
  

  while(1){

    cin >> a >> b >> h ;

    if ( nagai1 < a ) nagai1 = a; 
    if( nagai1 < b ){
      nagai1 = b; 
      nagai2 = a;
    }
    else nagai2 = b;

      if( nagai1 < h ){ 
      nagai2 = nagai1;
      nagai1 = h;
    }
      else if( nagai2 < h) nagai2 = h ;

 

    if ( a == 0 && b == 0 && h ==0) break;


    cin >> n;


    for ( int i = 0 ; i < n ; i ++){


    
      cin >> r[i] ;


      // テδづつセテδεつイテδづつキテδεつッテδ暗つステδεつδεつェテδづつ、テδ偲つキテδ療つサテδづつサ

      if ( nagai1 * nagai1 + nagai2 * nagai2  < 4 * r[i] * r[i]  ) hantei[i] = "OK";
      

 


      else hantei[i] = "NA";



      

      //

      cout << hantei[i] << endl ;

    }


      

  }


  return 0;

}

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

int main(){
  int stas[3];
  while(cin >> stas[0] >> stas[1] >> stas[2],stas[0]){
    sort(stas,stas+3);
    int n,r,tmp = stas[0]*stas[0]+stas[1]*stas[1];
    cin >> n;
    for(int i=0;i<n;++i){
      cin >> r;
      if(r*r*4>tmp)cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
}

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

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

    while(cin>>a>>b>>c,a||b||c){
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>r;
            if(min({a*a+b*b,a*a+c*c,b*b+c*c})<4*r*r){
                cout<<"OK"<<endl;
            }else{
                cout<<"NA"<<endl;
            }
        }
    }

    return 0;
}

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

int x[3];
void solve() {
    int n;
    cin >> n;
    int rs[n];
    for (int i = 0; i < n; i++) {
        cin >> rs[i];
    }

    sort(x, x+3);
    int diag_pow_2 = x[0] * x[0] + x[1] * x[1];

    for (int i = 0; i < n; i++) {
        if ( (rs[i] * 2) * (rs[i] * 2) > diag_pow_2) 
            cout << "OK" << endl;
        else 
            cout << "NA" << endl;
    }
}

int main() {
    while (cin >> x[0] >> x[1] >> x[2]) {
        if (x[0] == 0) break;
        solve();
    }
    return 0;
}