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 <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int tate,yoko,takasa,mn,md;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mn=min(min(tate , yoko) , takasa);
		if(tate>=yoko){
			if(yoko>=takasa) {
			    md=yoko;
			} else if (yoko<takasa) {
				if(tate>=takasa)  md=takasa;
				else if (tate<takasa)  md=tate;
			}
			
		} else if (tate<yoko){
			if (tate>=takasa){
				md=tate;
			} else if(tate<takasa){
				if(yoko>=takasa) md=takasa;
				else if(yoko<takasa) md=yoko;
			}
		}
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mn*mn+md*md) ? "OK" : "NA") << endl;
		}
		delete [] r;
	}
	return 0; 
}

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

int main(){
    while(1){
        int d,w,h;
        cin >> d >> w >> h;
        if(d==0) break;

        int diag = min(d*d +w*w, min(w*w +h*h, h*h +d*d));
        int n;
        cin >> n;
        for(int i=0; i<n; i++){
            int r;
            cin >> r;
            if(diag < 4*r*r){
                cout << "OK" << endl;
            }else{
                cout << "NA" << endl;
            }
        }
    }
    return 0;
}

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[2] == 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<cmath>
using namespace std;
int main(){

  int a,b,c,n,r[10000];
  double d1,d2,d3,d4,e;
   
  while(1){
    
    cin >>a>>b>>c;
    
    if( a == 0 && b == 0 && c == 0 )break;
    
    d1=sqrt(a*a+b*b);
    d2=sqrt(b*b+c*c);
    d3=sqrt(a*a+c*c);
    d4=sqrt(d1*d1+c*c);

    cin >>n;

    for(int i=0 ; i < n ; i++){
      cin >>r[i];
    }
    
    for(int i=0 ; i < n ; i++){
      
      e=2*sqrt(2*r[i]*r[i]);
      
      if( d1 < 2*r[i] ){
	
	cout <<"OK"<<endl;
	
      }else if( d2 < 2*r[i] ){
	
	cout <<"OK"<<endl;
	
      }else if( d3 < 2*r[i] ){
      
	cout <<"OK"<<endl;
	
      }else if(d4 < 2*r[i] ){
	  
	cout <<"OK"<<endl;

      }else{
	
	cout <<"NA"<<endl;
      
      }
      
    }
    
  }
  return 0;
  
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define FOR(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u){
    stringstream ss;
    ss << t;
    ss >> u;
}

double compute(double a, double b){
	double s    = ((a*2)+(b*2))/2;
	double tmp1 = (a*a+b*b)*(a*b+a*b)*(a*b+a*b);
	double tmp2 = (s-a)*(s-b)*(s-a)*(s-b);
	double res  = sqrt(tmp1/tmp2)/4;
	return res;
}

int main(){
	int t, y, h;
	while(cin >> t >> y >> h && t|y|h){
		int n;
		cin >> n;
		FOR(i, n){
			int  cir = 0;
			bool f   = false;
			cin >> cir;
			if(compute(t, y)<cir) f = true;
			if(compute(t, h)<cir) f = true;
			if(compute(y, h)<cir) f = true;

			if(f) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}

	return 0;
}

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

int pow(int x, int n) {
  int ans = 1;
  for(int i = 0; i < n; i++) {
    ans *= x;
  }
  return ans;
}

int main() {
  while(1) {
    int dat[3];
    cin >> dat[0] >> dat[1] >> dat[2];
    if(dat[0] == 0 && dat[1] == 0 && dat[2] == 0) break;

    int n;
    cin >> n;

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

      bool flag = false;
      for(int j = 0; j < 3; j++) {
	if(pow(dat[j], 2)+pow(dat[(j+1)%3], 2) < pow(r*2, 2)) {
	  flag = true;
	  break;
	}
      }
      if(flag) {
	cout << "OK" << endl;
      } else {
	cout << "NA" << endl;
      }
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	int h[3],r,n;
	int t;
	for(;;){
		rep(i,3)scanf("%d",h+i);
		sort(h,h+3);
		if(h[2]==0)break;
		t=(h[0]*h[0]+h[1]*h[1]);
		scanf("%d",&n);
		rep(i,n){
			scanf("%d",&r);
			puts(r*r*4>t?"OK":"NA");
		}
	}
	return 0;
}

C++: #include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int d, w, h, n, r[10000];
	while (cin >> d >> w >> h >> n && d != 0)
	{
		for (int i = 0; i < n; i++)
			cin >> r[i];
		int c0 = d*d + w*w;
		int c1 = d*d + h*h;
		int c2 = w*w + h*h;
		for (int i = 0; i < n; i++)
		{
			int p = 4 * r[i] * r[i];
			if (c0 < p || c1 < p || c2 < p)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}

	return 0;
}

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

int main(void)
{
	int num,kosu;
	int nyuuryoku[3],x,y;
	int cut_i,cut_j,tem;
	int hankei;
	double z;

	while(1){
		scanf("%d%d%d",&nyuuryoku[0],&nyuuryoku[1],&nyuuryoku[2]);
		if((nyuuryoku[0]==0)&&(nyuuryoku[1]==0)&&(nyuuryoku[2]==0)){
			break;
		}

		for(cut_i=0;cut_i<kosu-1;cut_i++){
			for(cut_j=cut_i;cut_j<kosu;cut_j++){
				if(nyuuryoku[cut_i]>nyuuryoku[cut_j]){
					tem=nyuuryoku[cut_i];
					nyuuryoku[cut_i]=nyuuryoku[cut_j];
					nyuuryoku[cut_j]=tem;
				}
		    }
		}
		x=nyuuryoku[1];
		y=nyuuryoku[2];
		
		z = sqrt((double)(x*x) + (double)(y*y));

		scanf("%d",&kosu);
		
		for(cut_i=0;cut_i<kosu;cut_i++){
			scanf("%d",&hankei);
			if(z>=hankei){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}

	}
	return 0;
}

C++: #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <typeinfo>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;



int main(){
    while(true){
        vector<int> a;
        rep(i,3){
            int tmp;
            cin>>tmp;
            a.push_back(tmp);
        }
        sort(a.begin(),a.end());
        if(a[0]==0 && a[1]==0 && a[2]==0)break;
    
        int n;
        cin>>n;
        
        rep(i,n){
            int x;
            cin>>x;
            if( pow( (a[0]/2) , 2 ) + pow( (a[1]/2) , 2 ) < pow(x,2))cout<<"OK"<<endl;
            else cout<<"NA"<<endl;
        }
    }

    return 0;
 }

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c;
	int n;
	int x;
	while(true){
		scanf("%d%d%d",&a,&b,&c);
		if(a==0&&b==0&&c==0)return 0;
		scanf("%d",&n);
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>c)swap(a,c);
		int z=a*a+b*b;
		for(int i=0;i<n;i++){
			scanf("%d",&x);
			if(z<(2*x)*(2*x))printf("OK\n");
			else printf("NA\n");
		}
	}
}