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 <stdio.h>

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int main(){
	int x,y,h;
	int m,n,t,c=0;
	int r[10000];

	cin >> x >> y >> h >> n;
	
	//detect most small surface
	m = x*y;
	if(m>x*h)m = x*h;
	if(m>y*h)m = y*h;

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

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

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


int main(){
    int i;
    
    int size[3];
    cin >> size[0] >> size[1] >> size[2];
    int NumOfHole;
    cin >> NumOfHole;
    int *radius;
    radius = new int[NumOfHole];
    for(i=0;i<NumOfHole;i++){
        cin >> radius[i];
    }
    int check[3];
    cin >> check[0] >> check[1] >> check[2];
    if(check[0]!=0 || check[1]!=0 || check[2]!=0){
        cout << "Misloading\n";
        return 0;
    }
    
    int max;
    int vmax=0;
    for(i=0;i<3;i++){
        if(vmax < size[i]){
            vmax=size[i];
            max=i;
        }
    }
    int obst=0;
    for(i=0;i<3;i++){
        if(i!=max){
            obst += size[i]*size[i];
        }
    }
    cout << "obst:" << obst;
    for(i=0;i<NumOfHole;i++){
        if(obst < 4*radius[i]*radius[i]){
            cout << "OK\n";
        }else{
            cout << "NA\n";
        }
    }
    
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int d,w,h,r,n,rd;
	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){
			cout<<"OK"<<endl;
			continue;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int x,y,z;
    while(1){
      cin>>x>>y>>z;
      if(x==0&&y==0&&z==0) return 0;
      int n;
      cin>>n;
      int a[10000];
      for(int i=0;i<n;i++){
        cin>>a[i];
      }
      double b[3];
      b[0]=sqrt(x*x+y*y);
      b[1]=sqrt(z*z+y*y);
      b[2]=sqrt(x*x+z*z);
      sort(b,b+3);
      double min=b[0];
      for(int i=0;i<n;i++){
          if((double)a[i]>(0.5*min)) cout<<"OK"<<endl;
          else cout<<"NA"<<endl;
      }
    }       
}

C++: #include <stdio.h>

int main(void)
{
	int w, l, h;
	int n;
	int i;
	int x;
	
	while (1){
		scanf("%d %d %d", &w, &l, &h);
		if (w == 0 && l == 0 && h == 0)break;
		
		if (w > h){
			w += h;
			h = w - h;
			w -= h;
		}
		if (l > h){
			l += h;
			h = h -l;
			l -= h;
		}
		if (w > l){
			w += l;
			l = w - l;
			w -= l;
		}
		scanf ("%d", &n);
		
		for (i = 0; i < n; i++){
			scanf("%d", &x);
			
			if (w * l <= x * x / 2 * 3.141592 && w <= x && l <= x * 2){
				printf("OK\n");
			}else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
 
int main(){
 
    double d,w,h,r,min,dw,wh,hd;
    int n;
 
    while(true){
        scanf("%lf %lf %lf",&d,&w,&h);
        if(d == 0.0 && w == 0.0 && h == 0.0)break;
 
        scanf("%d",&n);
 
        for(int i=0; i < n; i++){
            scanf("%lf",&r);
            dw = (sqrt(d*d+w*w))/2.0;
            wh = (sqrt(w*w+h*h))/2.0;
            hd = (sqrt(d*d+h*h))/2.0;
            min = min(dw,min(wh,hd));
            if(r > min){
                printf("OK\n");
            }else{
                printf("NA\n");
            }
        }
    }
    return 0;
}

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<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

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

int main(){
	int n, x, y, z, r;
	while( cin >> z >> x >> y, x||y||z ){
		cin >> n;
		int i=0;
		for( i=0; i<n; i++ ){
			cin >> r;
			int l = min( x*x+y*y, y*y+z*z );
			l = min( l, z*z+x*x );
			cout << ((4*r*r>l)?"OK":"NA") << endl;
		}
	}
	return 0;
}

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

int main(void)
{
	int a[3], n, b;
	while (scanf("%d %d %d", &a[0], &a[1], &a[2]), a[0]){
		sort(a, a + 3);
		int r = a[0]*a[0] + a[1]*a[1];
		cin >> n;
		for (int i = 0; i < n; i++){
			cin >> b;
			if (r < (b*2)*(b*2)) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	
	return 0;
}

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

using namespace std;

int main () {
	int d, w, h, n, r;
	while(true) {
		cin >> d >> w >> h;
		if (!d && !w && !h) break;

		int diagonal = min({
			d * d + w * w,
			d * d + h * h,
			h * h + w * w
		});

		cin >> n;
		while (n--) {
			cin >> r;
			cout << ((r * r * 4 > diagonal) ? "OK" : "NA") << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
using namespace std;
int main(){
	
	int l,w,h;
	int n;
	int r;
	while(cin>>l>>w>>h,l!=0&&w!=0&&h!=0){
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>r;
			if(l<2*r&&w<2*r&&h<2*r)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

bool check( VI ls, int r )
{
	REP( i, 0, 3 )
	{
		REP( j, i + 1, 3 )
		{
			if ( sqrt( pow( ls[i], 2 ) + pow( ls[j], 2 ) ) < 2 * r )
			{
				return true;
			}
		}
	}

	return false;
}

int main()
{
	while ( true )
	{
		VI ls( 3 );
		
		bool notlast = false;

		REP( i, 0, 3 )
		{
			cin >> ls[i];
			notlast |= ls[i] != 0;
		}

		if ( !notlast )
		{
			break;
		}

		int n;
		cin >> n;

		REP( i, 0, n )
		{
			int r;
			cin >> r;

			if ( check( ls, r ) )
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}