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<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>

using namespace std;

int main(){
  int a,b,c;
  int n;

  while(1){
    //a,b,cの入力
    /*    char line[100];
    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d %d",&a,&b,&c);
    */

    scanf("%d %d %d",&a,&b,&c);
    //a=b=c=0 なら終了
    if(a==0&&b==0&&c==0){
      break;
    }

    //対角線の半分を求め、その最大値を求める
    double d[3];
    d[0]=sqrt(a*a+b*b)/2;
    d[1]=sqrt(b*b+c*c)/2;
    d[2]=sqrt(c*c+a*a)/2;
    double maxd=d[0];
    for(int i=0;i<2;i++){
      if(maxd<d[i]) maxd=d[i];
    }

    //nの入力
    cin>>n;

    //rの入力、判定
    for(int i=0;i<n;i++){
      int r=0;
      cin>>r;
      if(maxd<r){
	cout<<"OK\n";
      }
      else{
	cout<<"NA\n";
      }
    }
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
typedef pair<int,int>pii;
int main(){
    int h,w,t,n;
    while(cin>>h>>w>>t,h||w||t){
        cin>>n;
        while(n--){
            int r;
            cin>>r;
            if(sqrt(w*w+t*t)<r*2)cout<<"OK"<<endl;
            else cout<<"NA"<<endl;
        }
    }

}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

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

	cin >> d >> d >> d;


	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int sq(int a){
return a*a;
}

int main(){
	double l[3],t;
	int m,n,c=0;
	int r[10000];

	cin >> l[0] >> l[1] >> l[2];
	cin >> n;

	//sort length
	sort(l,l+3);

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

		if(t==0){
			if(++c==3){
				break;
			}
		}

		/*cout << (sqrt(sq(t)-sq(l[0]/2))*2);
		cout << endl;
*/
		if((2*t > l[0]) && (sqrt(sq(t)-sq(l[0]/2))*2 > l[1])){
			r[i] = 1;
		}else{
			r[i] = 0;
		}
/*
		if(m<2*t*t){
			if((t*R>x&&t*R>y)||(t*R>x&&t*R>h)||(t*R>h&&t*R>y)){
				r[i] = 1;
			}else{
				r[i] = 0;
			}
		}else{
			r[i] = 0;
		}*/
	}


	for(int i=0;i<n;i++){
		if(r[i]==0){
			cout << "NA" << endl;
		}else{
			cout << "OK" << endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
	int a[3],n,w;
	while(true){
	cin>>a[0]>>a[1]>>a[2];
	if(a[0]==0&&a[1]==0&&a[2]==0)
		break;
	for(int i=0;i<2;i++){
        for(int j=2;j>i;j--){
	        if(a[j]>a[j-1]){
	        int tmp=a[j];
	        a[j]=a[j-1];
	        a[j-1]=tmp;
	        }
        }
    }
	double h=(double)sqrt((double)a[0]*a[0]+a[1]+a[1])/2;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>w;
		if(h<w)
			cout<<"OK"<<endl;
		else
			cout<<"NA"<<endl;
	}
	}
    return 0;
}

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

int main(){
	int n;
	double tate, yoko, takasa, ana, taikaku, hankei;
	while(1){
		cin >> tate >> yoko >> takasa;
		if(tate == 0 && yoko == 0 && takasa == 0){
			break;
		}

		if(tate > yoko){
			if(yoko > takasa){
				taikaku = sqrt(yoko * yoko + takasa * takasa);
			}

			else if(takasa > yoko && tate > takasa){
				taikaku = sqrt(yoko * yoko + takasa * takasa);
			}
		}

		else if(yoko > tate){
			if(tate > takasa){
				taikaku = sqrt(takasa * takasa + tate * tate);
			}

			else if(takasa > tate && yoko > takasa){
				taikaku = sqrt(takasa * takasa + tate * tate);
			}
		}

		else if(takasa > yoko){
			if(yoko > tate){
				taikaku = sqrt(yoko * yoko + tate * tate);
			}

			else if(tate > yoko && takasa > tate){
				taikaku = sqrt(yoko * yoko + tate * tate);
			}
		}

		hankei = taikaku / 2;

		cin >> n;

		for(int i = 0; i < n; i++){
			cin >> ana;
			if(ana > hankei){
				cout << "OK" << endl;
			}

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

	return 0;
}

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

int main()
{
	int a[3];
	while(cin>>a[0]>>a[1]>>a[2]&&(a[0]||a[1]||a[2]))
	{
		sort(begin(a),end(a));
		int n;cin>>n;
		int l=a[0]*a[0]+a[1]*a[1];
		
		for(int i=0;i<n;i++)
		{
			int k;cin>>k;
			k*=2;
			k*=k;
			cout<<(l>=k?"NA":"OK")<<endl;
			
		}
	}
	
	
}

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

int main(){
	int s1,s2,b;
	while(cin >> s1 >> s2 >> b){
		if(s1 == 0 && s2 == 0 && b == 0) break;
		
		if(s1 >= s2) swap(s1,s2);
		if(s2 >= 	b) swap(s2,b);
		int n;
		cin >> n;
		for(int i = 0; i < n; i++){
			int r;
			cin >> r;
		 if(sqrt(s1*s1 + s2*s2) >= r*2) cout << "NA" << endl;
			else cout << "OK" << endl;
		}
	}
}

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

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

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

using namespace std;

int main() {

	int x, y, h;

	while(cin >> x >> y >> h) {
		if(!x&&!y&&!h) {
			break;
		}
		deque<int> c;
		c.push_back(x);
		c.push_back(y);
		c.push_back(h);
		sort(c.begin(), c.end());
		double R=sqrt(pow((double)c[0], 2)+pow((double)c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	return 0;

}

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

C++: #include <cstdio>
#include <algorithm>
using namespace std;
bool ok(int a, int b, int c) {
    if (a*a+b*b<c*c) return true;
    else return false;
}
int main() 
{
    int row,col,high;
    int n;
    int dir;
    while (scanf("%d%d%d",&row,&col,&high)) {
        if (row==0&&col==0&&high==0) break;
        scanf("%d",&n);
        for (int i=0; i<n; i++) {
            scanf("%d",&dir);
            dir*=2;
            if (ok(row,col,dir)||ok(row,high,dir)||ok(col,high,dir)) {
                printf("OK\n");
            }
            else {
                printf("NA\n");
            }
        }
    }
}

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

int main()
{
	while (1) 
	{
		vector<int>a(3);
		cin >> a[0] >> a[1] >> a[2];
		if (a[0] == 0 && a[1] == 0 && a[2] == 0)break;
		int b;
		cin >> b;
		for (int c = 0; c < b; c++) {
			int d;
			cin >> d;
			if (d*2> a[0] && d*2> a[1])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}