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 <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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    double x, y, z;
    while(cin >> x >> y >> z, x+y+z){
        vector<double> v;
        v.push_back(x); v.push_back(y); v.push_back(z);

        sort(all(v));
        int n;
        cin >> n;
        for(int i=0; i < n; i++){
            double r;
            cin >> r;
            if(r*2 > sqrt(pow(v[0], 2)+pow(v[1], 2))) cout << "OK" << endl;
            else cout << "NA" << endl;
        }
    }
}

C++: #include<stdio.h>
int main(void)
{
	int t,y,ts;
	int n;
	int h[10000],m;
	int i;
	scanf("%d %d %d",&t,&y,&ts);
		while(!(t==0 && y==0 && ts==0)){
			scanf("%d",&n);
				for(i=0;i<n;i++){
					scanf("%d",&h[i]);
					m=2*h[i];
					if((m>y) || (m>ts)){
						printf("OK\n");
					}
					else if((m>y) || (m>t)){
						printf("OK\n");
					}
					else if((m<=y) || (m<=ts)){
						printf("NA\n");
					}
					else if((m<=y) || (m<=t)){
						printf("NA\n");
					}
				}
				scanf("%d %d %d",&t,&y,&ts);
			}
		return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#define PI 3.14159265358979323846264

using namespace std; 



int main(void){

	int n;
	double v,box_area[5],height,width,depth,min_area;
	
	vector<double> hole;
	vector<double> hole_area;
	
	while(1){
	
		height=0;
		width=0;
		depth=0;
		n=0;
		min_area=0;
		
		hole.clear();
		
		hole_area.clear();

		for(int i=0;i<5;i++){
			box_area[i]=0;
		}
		
		scanf("%lf %lf %lf",&height,&width,&depth);
		
		if(height==0 && width==0 && depth==0){
			break;
		}
		
		scanf("%d",&n);

		for(int i=0;i<n;i++){
			cin>>v;
			hole.push_back(v);
		}

		for(int i=0;i<n;i++){
			hole_area.push_back(hole[i]*2.0);
			//printf("hole_area[%d]=%lf\n",i,hole_area[i]);
		}

		box_area[0]=sqrt(1.0*height*height+1.0*width*width);	//¼ûÌÌ3ÊÌ»ê¼êÌÎpü
		box_area[1]=sqrt(1.0*height*height+1.0*depth*depth);
		box_area[2]=sqrt(1.0*width*width+1.0*depth*depth);

		/*for(int i=0;i<3;i++){
			printf("box_area[%d]=%lf\n",i,box_area[i]);
		}
		printf("hei=%lf wid=%lf dep=%lf\n",height,width,depth);*/
		
		min_area=min(box_area[0],min(box_area[1],box_area[2]));
		
		//printf("¼ûÌÌÅ¬ÊÏÍ:%lf\n",min_area);

	
		for(int i=0;i<n;i++){
			
			if(hole_area[i]>min_area){
				printf("OK\n");			
			}
			else{
				printf("NA\n");	
			}
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int number;
	cin>>number;
int r[100];
int n=0;

while(true){
	int temp;
	cin>>temp;
	if(n==number+2&&temp==0&&r[n-1]==0&&r[n-2]==0){
		break;
	}
	else{
		r[n]=temp;
		n=n++;
	}
}
	int rec1,rec2,rec3;
	rec1=a*a+b*b;
	rec2=a*a+c*c;
	rec3=b*b+c*c;


	for (int i=0;i<(n-2);i++){
	 if (4*r[i]*r[i]>rec1||4*r[i]*r[i]>rec2||4*r[i]*r[i]>rec3){
		 cout<<"OK"<<endl;
	 }
	 else{
		 cout<<"NA"<<endl;
	 }
	}
return 0;

}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){

  vector<int>in(3);
	while(cin>>in[0]>>in[1]>>in[2],in[0]||in[1]||in[2]){
  	sort(in.begin(),in.end());	
	  double h=hypot(in[0],in[1])/2;
	
  	int n;
	  cin>>n;
	  rep(i,n){
		  int ans;
		  cin>>ans;
		  if(h<ans)cout<<"OK"<<endl;
		  else cout<<"NA"<<endl;
		}
	
	}
}

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

#define loop for (;;)
#define repeat(i, n) for (int i = 0; i < (n); i++)

inline bool inside(double a, double b, int r) {
  return a*a+b*b < (double)(r*r);
}

using namespace std;

int main() {
  loop {
    double a, b, c;
    cin >> a >> b >> c;
    if (!(a || b || c)) return 0;
    a /= 2;
    b /= 2;
    c /= 2;
    int n;
    cin >> n;
    repeat(i, n) {
      int r;
      cin >> r;
      if (inside(a, b, r) || inside(b, c, r) || inside(c, a, r))
        cout << "OK" << endl;
      else
        cout << "NA" << endl;
    }
  }
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
//#define M(a,b) a<b?a:b
int main(){
	int a,b,c,n,r;
	for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2*r>std::min(std::min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

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

//0107
int main(){
	int a, b, c;
	int n, r;
	int first, second;
	list<int> el(0);

	while(cin >> a >> b >> c){
		if(a==0 && b==0 && c==0)break;
		el.push_back(a);
		el.push_back(b);
		el.push_back(c);
		el.sort();
		list<int>::iterator ite = el.begin();
		first = *ite++;
		second = *ite;

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

			//三平方の定理でチーズの対角線を求めて、
			//それが直径より大きいかで判定する
			if( (2*r)*(2*r) > (first*first)+(second*second)){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}

	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 < n; ++i)
#define rep(i, n) reep(i, 0, n)

int main()
{
    int a, b, c;
    int n;
    int r;
    while (scanf("%d %d %d", &a, &b, &c))
    {
        if (a == 0 and b == 0 and c == 0)
            return 0;
        scanf("%d", &n);
        int r1;
        r1 = a * a + b * b;
        r1 = min(r1, b * b + c * c);
        r1 = min(r1, c * c + a * a);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &r);
            printf("%s\n", 4 * r * r > r1 ? "OK" : "NA");
        }
    }
    return 0;
}

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

int main(){
  std::vector<int> size[3];
  int x, n, r;
  
  std::cin >> x;
  size.push(x);
  std::cin >> x;
  size.push(x);
  std::cin >> x;
  size.push(x);
  size.sort(size.begin(), size.end());
  
  while(d!=0 && w!=0 && h!=0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std;;cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
  }
  
  return 0;
}