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<math.h>
#include<algorithm>
using namespace std;
int nijyou(int i ){return i*i;}
int main() {
	while(1){
	int a[3];
	cin>>a[0] >>a[1]>>a[2];
	if(a[0]==0&&a[1]==0&&a[2]==0){break;}
	sort(a,a+3);
	int n;
	cin>>n;
	double y = sqrt(nijyou(a[0])+nijyou(a[1]));
	for(int i = 0;i<n;i++){
		double k;
		cin>>k;
		if(k*2>y){cout<<"OK"<<endl;}
		else{cout<<"NA"<<endl;}
	}
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-6
using namespace std;

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

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		double dis = v[0]*v[0] + v[1]*v[1];

		int n;
		cin >> n;

		while(n--)
		{
			double r;
			cin >> r;

			r *= 2;
			r *= r;

			if((r-dis) > EPS)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}

		}
	}
	return 0;
}

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

using namespace std;

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

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

int n, r;
int ch[3];

void solve() {
    double a, b, c;
    a = pow(ch[0], 2);
    b = pow(ch[1], 2);
    c = pow(2*r,   2);

    if (a+b < c) {
        std::cout << "OK" << std::endl;
    } else {
        std::cout << "NA" << std::endl;
    }
}

int main() {
    while (true) {
        for (int i=0; i<3; i++) std::cin >> ch[i];
        
        if (!ch[0] && !ch[1] && !ch[2]) break;
        
        std::sort(ch, ch+3);

        std::cin >> n;
        
        for (int i=0; i<n; i++) {
            std::cin >> r;
            solve();
        }
    }
}

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


int main() {
	double n, r, a, b, c, d, e, f;
	while(1){
	cin >> a >> b >> c;
	if(a == 0 && b == 0 && c == 0) break;
	a *= a; b *= b; c *= c;
	d = sqrt(b + c) / 2;
	e = sqrt(a + c) / 2;
	f = sqrt(a + b) / 2;
        cin >> n;
	for(int i = 0;i < n;++i){
		cin >> r;
		if(d < r || e < r || f < r) cout << "OK" << endl;
		else cout << "NA" << endl;
	    }
	}
	return 0;
}

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

using namespace std;

int main(void){

  int a[3];
  while( cin >> a[0] >> a[1] >> a[2] , ( a[0] || a[1] || a[2] ) ){
    
    int n;
    cin >> n;
    sort( a , a + 3 );
    int R = a[0]*a[0] + a[1]*a[1];

    while(n--){
      int r;
      cin >> r;
      if( 2 * r > sqrt(R) ) cout << "OK" << endl;
      else cout << "NA" << endl;
      
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int in1, in2, in3;
	while (true) {
		cin >> in1 >> in2 >> in3;
		if (in1 == 0 && in2 == 0 && in3 == 0) { break; }
		vector<int>a;
		a.pb(in1);
		a.pb(in2);
		a.pb(in3);

		Sort(a);
		int n;
		cin >> n;
		double save = sqrt(a[0] * a[0] + a[1] * a[1]) / 2.00;
		rep(i, n) {
			double r;
			cin >> r;
			if (r > save) { cout << "OK" << endl; }
			else { cout << "NA" << endl; }
		}
		return 0;
	}
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-6
using namespace std;

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

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		double dis = v[0]*v[0] + v[1]*v[1];
		cout << dis << endl;

		int n;
		cin >> n;

		while(n--)
		{
			int r;
			cin >> r;

			r *= 2;

			if(dis < r*r)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}

		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
using namespace std;
int main(){
	
	int l,w,h;
	int n;
	int r;
	while(cin>>l>>w>>h,l!=0&&w!=0&&h!=0){
		cin>>n;
		vector<int> r(n);
		for(int i=0;i<n;i++)
			cin>>r[i];
		for(int i=0;i<n;i++){
			if(l<2*r[i]&&w<2*r[i]&&h<2*r[i])
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

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

int main(){
  while(1){
    int d, w, h;
    scanf("%d %d %d", &d, &w, &h);
    if(d==0 && w==0 && h==0)
      break;
    int n;
    scanf("%d", &n);
    
    int max = (int)fmax((double)d, fmax((double)w, (double)h));
    double a = sqrt(d*d+w*w+h*h-max*max) / 2;

    int i;
    for(i=0;i<n;i++){
      int b;
      scanf("%d", &b);
      //printf("a:%lf b:%d", a, b);
      if((double)b <= a)
	printf("NA\n");
      else
	printf("OK\n");
    }
  }
  return 0;
}