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 <math.h>
using namespace std;

int main(){
doIt();
}
void doIt(){
	int a,b,c,n,i;
	cin >> a >> b >> c;
	while(a + b + c > 0){
		cin >> n;
		int r[n];
		//cout << sqrt(a*a + b*b) / 2 << ", " << sqrt(b*b + c*c) / 2 << "," << sqrt(a*a + c*c) / 2;
		for(i = 0; i < n; i++){
			std::cin >> r[i];
			//斜辺を計算する
			bool bOK = false;
			if(sqrt(a*a + b*b) / 2 < r[i] || sqrt(b*b + c*c) / 2 < r[i] || sqrt(c*c + a*a) / 2 < r[i]){
				bOK = true;
			}
			if(bOK){
				cout << "OK" << endl;
			}
			else{
				cout << "NA" << endl;
			}
		}
		cin >> a >> b >> c;
	}
}

C++: #include<iostream>
using namespace std;
int a,d,w,h,x;
main()
{
    while(cin>>d>>w>>h,d)
    {
        if(d>=w&&d>=h)x=w*w+h*h;
        else if(w>=d&&w>=h)x=d*d+h*h;
        else x=d*d+w*w;
        int n;cin>>n;
        while(n--)
        {
            cin>>a;
            a=a*a*4;
            cout<<(a>x?"OK":"NA")<<endl;
        }
    }
}

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

int main(){
	int x, y, z;
	while(cin >>x >>y >>z){
		if(x == 0 && y == 0 && z == 0) break;
		int n;
		cin >>n;
		for(int i = 0; i < n; i++){
			int door;
			cin >>door;
			if(door >= x || door >= y || door >= z){
				cout <<"OK" <<endl;
			} else{
				cout <<"NA" <<endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

void solve(){
}

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

  while(cin>>a>>b>>c,a||b||c){
    double len = min(a*a+b*b, min(a*a+c*c, b*b+c*c));
    int n;
    cin>>n;

    rep(i,n){
      double r;
      cin>>r;
      r *= 2;
      if(len > r*r){
        cout<<"NA\n";
      }
      else{
        cout<<"OK\n";
      }
    }
  }
}

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

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

C++: #include <iostream>
#include <cmath>
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 <stdio.h>
#include <math.h>
int main(void)
{
  int i;
  double temp;
  double x[3];
  int y, z;
  int n;
  double t;

  while(1){
    for(i=0; i<3; i++)
      scanf("%d", &x[i]);
    if(x[0]==0 && x[1]==0 && x[2]==0)
      break;
      
  for(i=0; i<2; i++){
    if(x[i]>x[i+1]){
      temp=x[i];
      x[i]=x[i+1];
      x[i+1]=temp;
    }
  }
  
  t=x[0]*x[0]+x[1]*x[1];
  t=sqrt(t);
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    scanf("%d", &y);
    
    if(2*y>t)
      printf("OK\n");
    else
      printf("NA\n");
    
  }
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int a, b, c, n, r, p;
  while(true){
    cin >> a >> b >> c;
    if(a==0 && b==0 && c==0)
      break;
    p = max(a, b);
    p = max(p, c);
    cin >> n;
    while(n--){
      cin >> r;
      if(2*r > p)
	cout << "OK\n";
      else
	cout << "NA\n";
    }
  }
  return 0;
}

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

using namespace std;

int main(void){
	int a[3],n;
	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){
		int r;
		cin >> r;
		if (r>d)
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}


	return 0;
}

C++: #include<stdio.h>
int i,j,k,temp;

int bouble_sort(int area[5]){	//ou\[gbox_area[0]ªÅ¬l
	
	temp=0;
	for(i=0;i<3-1;i++){						
		for(j=3-1;i<j;j--){
			if(area[j-1]>area[j]){
				temp=area[j];
				area[j]=area[j-1];
				area[j-1]=temp;
			}
		}
	}
	return area[2];
}

int main(void){

	
	int n,height,width,depth,box_area[5],max_area;
	int hantei[10000]={0};
	double hole_area[10000],hole[10010]={0};

	
	height=0;
	width=0;
	depth=0;
	
	
	scanf("%d %d %d\n",&height,&width,&depth);
	scanf("%d",&n);

	
	for(i=0;i<n+1;i++){
		
		scanf("%lf",&hole[i]);
	
	if(hole[i]==0){
			break;
		}
	}

	
	for(i=0;i<n;i++){
		hole_area[i]=hole[i]*hole[i]*3.14;
	}

	box_area[0]=height*width;	//¼ûÌÌ3ÊÌ»ê¼êÌÊÏ
	box_area[1]=height*depth;
	box_area[2]=width*depth;

	
	bouble_sort(box_area);
	max_area=bouble_sort(box_area);
	
	
	/*for(i=0;i<5;i++){
		printf("box_area[%d]=%d\n",i,box_area[i]);
	}

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

	
	for(i=0;i<n;i++){
		if(hole_area[i]>max_area){
			hantei[i]=1;
		}
		else{
			hantei[i]=0;
		}
	}

	for(i=0;i<n;i++){
		if(hantei[i]==1){
			printf("OK\n");
			}
		else{
			printf("NA\n");	
		}
	}
	
	return 0;
}

C++: #include<iostream>

int a, b, c;
int n;

int main()
{
	while( std::cin >> a >> b >> c, a | b | c )
	{
		std::cin >> n;

		int mi = std::min( a, std::min( b, c ) );
		int ma = std::max( a, std::max( b, c ) );
		int snd = a + b + c - mi - ma;

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

			if( mi * mi + snd * snd < 4 * r * r )
				std::cout << "OK" << std::endl;
			else
				std::cout << "NA" << std::endl;
		}
	}

	return 0;
}

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

using namespace std;

int main() {
	double W, H, D, a, b, r, ab;

	while (cin >> W >> H >> D) {
		int n;
		if (W == 0 && H == 0 && D == 0) break;

		a = min(min(W, H), D);
		b = min(max(W, H), D);

		ab = a*a + b*b;

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

			r = (r * 2) * (r * 2);

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

C++: 
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  while(1){
    int a,b,c,d[10010],n,i,j,temp;
    cin >> a >> b >> c;
    temp=c*c+b*b;
    if(a == 0 && b== 0 && c == 0){
      break;
    }
    cin >> n;
    for(i=0;i<n;i++){
      cin >> d[i];
      if(sqrt(temp) < d[i]*2){
	cout << "OK" << endl;
      }
      else if(c >= d[i]*2 || b >= d[i]*2){
	cout << "NA" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
	int d,w,h,r,n,rd,rs,rw;
	while(cin>>d>>w>>h){
		if(d==0&&w==0&&h==0)break;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r;
		rd=r*2;
		if(d<rd&&w<rd&&h<rd){
			rs=rd*r;
			rw=sqrt((double)rs);
			rw=rw*4;
			if((d+w+h)<rw)cout<<"OK"<<endl;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}