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 <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;
			a *= 2;
			if((a * a > w * w + d * d) || (a * a > h * h + w * w) || (a * a > h * h + d * d)){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main() {
  int size[3];
  scanf("%d %d %d", size, size + 1, size + 2);
  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 diameter = radius * 2;
    puts((diameter * diameter > squared_chord) ? "OK" : "NA");
  }

  return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>


using namespace std;

void Solution()
{
    int l, w, h;
    
    while (cin>>l>>w>>h, l) //when l or w or h = 0 it shoud be break
    {
        int n;
        
        cin>>n;
        
        while (n--)
        {
            int r;
            
            cin>>r;
            
            r *= 2;
            
            if((r * r > w * w + h * h) || (r * r > l * l + w * w) || (r * r > l * l + h * h))
            {
                cout<<"OK"<<endl;
            }
            else
            {
                cout<<"NA"<<endl;
            }
        }
    }

}

int main()
{
    Solution();
    return 0;
}

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

int main(){

  double a[5],d,c;
  int n;

  while(cin >> a[0] >> a[1] >> a[2], a[0], a[1], a[2]){
    cin >> n;

    sort(a,a+3);

    c = sqrt(a[0]*a[0] + a[1]*a[1]);

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

      if(2*d < c) cout << "NA" << endl;
      else cout << "OK" << endl;

    }
  }
}

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)res.PB("NA");
		else res.PB("OK");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a[3],n,i=0,r;
	cin>>a[0]>>a[1]>>a[2];
	if(!a[0])return 0;
	cin>>n;
	sort(a,a+3);
	cout<<a[0]*a[0]+a[1]/2*a[1]/2<<endl;
	for(;i<n;i++){
		cin>>r;
		cout<<((a[0]*a[0]+a[1]*a[1]<4*r*r)?"OK":"NA")<<endl;
	}
}

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

using namespace std;


int main() {

  int h,w,d;
  int n;
  int r;

  double min_r;


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

    if(h==0 && w==0 && d==0) break;

    cin >> n;

    if(sqrt(h*h+w*w)>sqrt(w*w+d*d)) {

      if(sqrt(w*w+d*d)>sqrt(d*d+h*h)) min_r=sqrt(d*d+h*h)/2.0;

      else min_r=sqrt(w*w+d*d)/2.0;

    }

    else {
	
      if(sqrt(h*h+w*w)>sqrt(d*d+h*h)) min_r=sqrt(d*d+h*h)/2.0;

      else min_r=sqrt(h*h+w*w)/2.0;
      
    }

    //cout << min_r << endl;

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

      cin >> r;

      if(min_r<(double)r) cout << "OK" << endl;

      else cout << "NA" << endl;

    }

  }

  return 0;

}

C++: #include<cstdio>
#include<algorithm>
#include<functional>
#include<iostream>
#include<cmath>
#define LL long long
using namespace std;
int main(void)
{
	LL d,w,h,i,j,k,in,n;
	LL dis1,dis2,dis3,T;

	while(1) {	
		cin>>d>>w>>h;
		if(!d&&!w&&!h) break;
		cin>>n;
		for(i=0;i<n;i++) {
			cin>>in;
			T=(in*2)*(in*2);
			dis1=(w*w)+(h*h);
			dis2=(w*w)+(d*d);
			dis3=(h*h)+(d*d);
			if(dis1<T||dis2<T||dis3<T) cout<<"OK\n";
			else cout<<"NA\n";
		}
	}
}

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

const double eps = 1e-9;

int main() {
    int w,h,l;
    while(cin>>w>>l>>h, w|l|h) {
        int rr = w*w+h*h;
        rr = min(h*h+l*l, rr);
        rr = min(l*l+w*w, rr);
        int n,r;
        cin>>n;
        for(int i=0; i<n; ++i) {
            cin>>r;
            if(r*r*4 > rr) cout<<"OK"<<endl;
            else cout<<"NA"<<endl;
        }
    }
}

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

int main(){
	int x,y,z,n,r;
	float r1,r2,r3;
	while(cin>>x>>y>>z,x|y|z){
		r1 = sqrt(x*x+y*y)/2;
		r2 = sqrt(x*x+z*z)/2;
		r3 = sqrt(y*y+z*z)/2;
		for(cin>>n;n;--n){
			cin>>r;
			if(r>r1 || r>r2 || r>r3)cout<<"OK";
			else cout<<"NA";
			cout<<endl;
		}
	}
	return 0;
}

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

int main(){
	int en;
	int i,y,k;
	int n;
	while(cin >> i >> y >> k , i * y * k){
		int max = sqrt (i * i + y * y);
		if(max < sqrt (k * k + y * y) ) max = sqrt (k * k + y * y);
		if(max < sqrt (i * i + k * k) ) max = sqrt (i * i + k * k);
		cin>>n;
		for(int i = 0 ; i < n ; i++){
			int m;
			cin>>m;
			cout<<2*m<<" "<<max<<endl;
			 if(max<=m*2)cout << "OK" << endl;
			 else cout << "NO" << endl; 
		}
		
	}

}

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

int main()
{
while(1){

    int a,b,c;
    cin>>a>>b>>c;
    if(a==0&&b==0&&c==0)break;
    int d;
    cin>>d;
    for(int e=0;e<d;e++){
    int f;
    cin>>f;

    if(f*2>b&&f*2>c){
            cout<<"OK\n";
    }
    else{
        cout<<"NA\n";
    }

    }
}

}