Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		line := strings.Split(stdin.Text(), " ")
		len := []int{}
		for i := 0; i < 3; i++ {
			tmp, _ := strconv.Atoi(line[i])
			len = append(len, tmp)
		}
		if len[0] == 0 && len[1] == 0 && len[2] == 0 {
			break
		}
		sort.Ints(len)
		d2 := len[0]*len[0] + len[1]*len[1]
		stdin.Scan()
		n, _ := strconv.Atoi(stdin.Text())
		for i := 0; i < n; i++ {
			stdin.Scan()
			r, _ := strconv.Atoi(stdin.Text())
			if 4*r*r > d2 {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {

  int a[3];

  while(1) {
  cin >> a[0] >> a[1] >> a[2];
  if(a[0] + a[1] + a[2] == 0) break;

  sort(a,a+3);
  int n;
  cin >> n;

  int s = a[0]*a[0] + a[1]*a[1];
  for(int i=0;i<n;i++) {
    int r;
    int c;
    cin >> r;
    c = 4*r*r;
    //cout << s <<" " << c<<endl;

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

  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(){
	int 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]) && (sq(t*2)-sq(l[0]) > sq(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 <algorithm>
#include <cmath>
using namespace std;

int main() {
  int c[3], n, a;
  
  while(1) {
    for(int i=0; i<3; i++)
      cin>>c[i];
    if(c[0]==0) break;
    
    sort(c, c+3);
        
    cin>>n;
    for(int i=0; i<n; i++) {
      cin>>a;
      cout<<((sqrt(c[0]*c[0]+c[1]*c[1])<2*a)?"OK":"NA") << endl;
    }
  }
  return 0;
}

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

using namespace std;

int A, B, C, R, n;

int main(void) {
    scanf("%d%d%d", &A, &B, &C);
    scanf("%d", &n);

    while(n > 0) {
        scanf("%d", &R);

        if(R * 2 > A && R * 2 > B && R * 2 > C) {
            printf("OK\n");
        } else {
            printf("NA\n");
        }
        n--;
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<math.h>
#include<iomanip>
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 r,c,h;
	while(cin>>r>>c>>h,r) 
	{
		int n; cin>>n;
		for(int i = 0; i < n; ++i)
		{
			int rr; cin>>rr; rr*=2;
			if(sqrt(rr*rr)<=sqrt(r*r+c*c)&&sqrt(rr*rr)<=sqrt(c*c+h*h)&&sqrt(rr*rr)<=sqrt(h*h+r*r)) cout<<"NA"<<endl;
			else cout<<"OK"<<endl;
		}
	}
  return 0;
}

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 mind=d[0];
    for(int i=0;i<2;i++){
      if(mind>d[i]) mind=d[i];
    }

    //nの入力
    cin>>n;

    //rの入力、判定
    for(int i=0;i<n;i++){
      double r=0;
      cin>>r;
      if(mind<r){
	cout<<"OK\n";
      }
      else{
	cout<<"NA\n";
      }
    }
  }
  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<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	for(;;){
		int length[3];
		rep(i, 3)
			scanf("%d", &length[i]);
		if(length[0]+length[1]+length[2] == 0)
			break;
		sort(length, length+3);
		int l = (length[0]*length[0] + length[1]*length[1])/4;

		int n;
		scanf("%d", &n);
		rep(i, n){
			int r;
			scanf("%d", &r);
			puts(r*r>l ? "OK" : "NA");
		}
	}
	return 0;
}

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

int main(){
	int a,b,c,n,r,R;
	while( cin >> a >> b >> c , a || b || c ){
		cin >> n;
		for(int i=0 ; i < n ; i++ ){
			bool ans = true;
			cin >> r;
			R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
			if( 2*r <= R ) ans = false;
			cout << (ans?"OK":"NA") << endl;
		}
	}
}

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(){
	float l[3];
	int m,n,c=0;
	int r[10000];
	float t;

	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;
			}
		}

		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 <vector>
#include <algorithm>

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> size[0];
  std::cin >> size[1];
  std::cin >> size[2];
  std::sort(size.begin(), size.end());
  
  while(size[0]=0 && size[1]=0 && size[2]=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;
      }
    }
    std::cin >> size[0];
    std::cin >> size[1];
    std::cin >> size[2];
    std::sort(size.begin(), size.end());
  }
  
  return 0;
}

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

using namespace std;

int A, B, C;
int R;

double norm(double x, double y) {
	return sqrt(x * x + y * y);
}

bool isok() {
	return (norm(A, B) / 2.0 < R || norm(B, C) / 2.0 < R || norm(C, A) / 2.0 < R);
}

int main() {
	while (1) {
		cin >> A >> B >> C; if (A == 0 && B == 0 && C == 0) break;
		int n; cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> R;
			if (isok()) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	
	return 0;
}