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++: #include <iostream>
#include <string>
#define MAX 10000
using namespace std;



int main(void){

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

  while(1){

    cin >> a >> b >> h ;

 
    if( nagai1 > a ){

      nagai1 = a;
      nagai2 = a;
    }

    if(nagai1 >= b > nagai2 ){

      nagai1 = b;
      
    }

    else if( b <=  nagai2) nagai2 = b;

    if( nagai1 >= h > nagai2){

      nagai1 = h;

    }

    else if( h <= nagai2 ) 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 <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#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()

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

C++: #include <iostream>
#include <math.h>
#define MAX_N 100000
using namespace std;
int n,m=0,r;
double d,w,h,minl; 
int main(){
	while(1){
		cin >> d>> w>> h;
		if(d==0 && w==0 && h==0)break;

		minl=MAX_N;
		if(sqrt(d*d+w*w)<minl)minl=sqrt(d*d+w*w);
		if(sqrt(h*h+w*w)<minl)minl=sqrt(h*h+w*w);
		if(sqrt(d*d+h*h)<minl)minl=sqrt(d*d+h*h);
		cin >> n;
		m=n;
		while(n--){
			cin >> r;
			if(2*r>minl){
				cout << "OK"<<endl;
			}else{
				cout << "NA"<<endl;
			}
		}
	}
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	LL a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	double bd=sqrt(a[1]*a[1]+a[0]*a[0]);
	int cnt=0;
	while(cnt<N){
		double t;
		cin>>t;
		if(t*2<=bd)cout<<"NA"<<endl;
		else cout<<"OK"<<endl;
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	
	return 0;
}

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

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		vector<int>s{ a,b,c };
		if (!a && !b && !c)break;
		sort(s.begin(), s.end());
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			int f;
			cin >> f;
			if (f*2>s[2])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

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

#define EPS 1e-8

int n;
double r;
double ls[3];

int main() {
  while (1) {
    for (int i=0; i<3; i++) scanf("%lf", &ls[i]);
    if (ls[0] == 0.0) return 0;
  
    scanf("%d", &n);
    for (int i=0; i<n; i++) {
      scanf("%lf", &r);
  
      bool found = false;
      for (int i=0; i<3; i++) {
        double d = ls[i]/2;
        if (2*sqrt(r*r-d*d)-EPS > ls[(i+1)%2]) {
          found = true;
          break;
        }
      }
  
      if (found) puts("OK");
      else puts("NA");
    }
  }
}

C++: #include <stdio.h>

#define SQ(x) ((x) * (x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))

int main(void)
{
	int len, wid, hite;
	int r;
	int n;
	
	while (1){
		int couch;
		scanf("%d%d%d", &len, &wid, &hite);
		
		if (len == 0){
			break;
		}
		
		couch = MIN(SQ(len) + SQ(wid), MIN(SQ(len) + SQ(hite), SQ(wid) + SQ(hite)));
		
		scanf("%d", &n);
		
		for (int i = 0; i < n; i++){
			scanf("%d", &r);
			
			if (couch < SQ(2 * r)){
				puts("OK");
			}
			else {
				puts("NA");
			}
		}
	}
	
	return (0);
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime> 

using namespace std;

bool check(double x,double y,double z,double r){  
	return sqrt(x*x+y*y) < r*2;
}  
int main(){  
	int data[3],r,n;
	while(cin >> data[0] >> data[1] >> data[2],data[0]){      
		cin >> n;    
		for(int i=0;i<n;i++){        
			cin >> r;    
			bool ret = false; 
			sort(data,data+3);      
			do{         
				ret |= check(data[0],data[1],data[2],r);     
			}
			while(next_permutation(data,data+3));   
			cout << (ret?"OK":"NA") << endl; 
		} 
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		int d[3]={},n,r;
		rep(i,0,3) cin>>d[i];
		if(d[0]==0&&d[1]==0&&d[2]==0) break;
		sort(d,d+3);
		double l;
		l=pow(d[0]*d[0]+d[1]*d[1],0.5)*0.5;
		cin>>n;
		rep(i,0,n){
			cin>>r;
			o((l<r?"OK":"NA"));
		}
	}
}