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++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	double x, y, z,v;
	cin >> x >> y >> z;
	v = min(max(x,y),min(max(x,z),max(y,z)));
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double r;
		cin >> r;
		if (v <= r*sqrt(2.0))
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}
}

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

#define pow2(x) ((x) * (x))

using namespace std;

int main( void )
{
	int A, B, C;

	while (cin >> A >> B >> C, A | B | C)
	{
		int val = pow2(min(A, B)) + pow2(min(max(A, B), C));

		int n;
		cin >> n;

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

			if (pow2(2 * r) > val)
				cout << "OK";
			else
				cout << "NA";
			cout << endl;
		}		
	}
	return 0;
}

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

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
	vector<int> a(3);
	while(true)
	{
		cin >> a[0] >> a[1] >> a[2];
		if(a[0] == 0 && a[1] == 0 && a[2] == 0) break;

		sort(a.begin(),a.end());
		int d = a[0]*a[0] + a[1]*a[1];

		int n;
		cin >> n;
		rep(i,n)
		{
			int r;
			cin >> r;

			if(d < (r*2)*(r*2))
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

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

  int a,b,c,n,r[10000];
  double d1,d2,d3,e;
   
  while(1){
    
    cin >>a>>b>>c;
    
    if( a == 0 && b == 0 && c == 0 )break;
    
    cin >>n;
    
    d1=sqrt(a*a+b*b);
    d2=sqrt(b*b+c*c);
    d3=sqrt(a*a+c*c);
    
    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] ){
	
	if( a+b < e ){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else if( d2 < 2*r[i] ){
	
	if( b+c < e ){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else if( d3 < 2*r[i] ){
	
	if( a+c < e ){
	  cout <<"OK"<<endl;
	}else{
	  cout <<"NA"<<endl;
	}
	
      }else{
	cout <<"NA"<<endl;
      }
      
    }
    
  }
  return 0;
  
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	while (1) {

		vector<long long int>ls(3);
		cin >> ls[0] >> ls[1] >> ls[2];
		sort(ls.begin(), ls.end());
		long long int r = (ls[0] * ls[0] + ls[1] * ls[1]);
		if (!ls[0])break;
		long long int d; cin >> d;
		while (d--) {
			long long int n; cin >> n;
			if (4*n*n>r)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	return 0;
}

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

int main(){

int x,y,z,N,r;
int n[1001]={};
while(1){
scanf("%d %d %d",&n[0],&n[1],&n[2]);if(n[0]==0&&n[1]==0&&n[2]==0)break;
for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}

//printf("%d %d %d\n",n[0],n[1],n[2]);

double rad=atan2( (double)(n[1]), (double)(n[0]));
//rad=rad*3.141592/180;
//printf("%lf\n",rad);

scanf("%d",&N);
for(int i=0;i<N;i++){

scanf("%d",&r);
//printf("%d %lf\n",n[1],(r*2*sin(rad)));



if(n[1]>=(r*2*sin(rad)))printf("NA\n");
else printf("OK\n");
}
}
return 0;
}

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

int main()
{
	int temp,c,i;
	double r,x,y,z,f;
	cin>>x>>y>>z;

	if(x>y){
		temp=x;
		x=y;
		y=temp;
	}
	if(y>z){
		temp=y;
		y=z;
		z=temp;
	}

	r=sqrt(pow(x/2,2)+pow(y/2,2));

	cin>>c;
	for(i=0;i<c;i++){
		cin>>f;
		if(r<f)
			cout<<"OK\n";
		else cout<<"NA\n";
	}
	return 0;
}

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

int main(){

  int a,b,c;
  
  while(1){

    int n;
    int d;
  
    scanf("%d %d %d",&a,&b,&c);
    if(a==0 && b==0 && c==0) break;
    scanf("%d",&n);
    
    d = min(a*a+b*b , min(a*a+c*c , b*b+c*c));
    
    for(int i=0;i<n;i++){
      int r;
      int f=1;
      
      scanf("%d",&r);
      r = (2*r)*(2*r);
      if(r<=d) f=0;

      //printf("%d %d ",r,d);
      
      if(f) printf("OK\n");
      else printf("NA\n");
    }


  }
  return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	stringstream buf;
	int a,b,c,n;
	scanf("%d %d %d %d",&a,&b,&c,&n);
	vector<int> args;
	args.push_back(a);
	args.push_back(b);
	args.push_back(c);
	sort(args.begin(),args.end());
	for(int x=0;x<n;++x){
		int r;
		scanf("%d",&r);
		double l = sqrt(2)*r;
		if(l>args[0] && l>args[1]){
			buf<<"OK\n";
		}else{
			buf<<"NA\n";
		}
	}
	scanf("%d %d %d",&a,&b,&c);
	cout<<buf.str();
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
	while( true ){
		int n;
		int x,y,z;
		
		cin >> x >> y >> z;
		if( x==0&&y==0&&z==0 ) break;
		cin >> n;

		for(int i = 0; i < n; i++){
			int r;
			cin >> r;
			if( (x*x/4)+(y*y/4) < r*r ||
				(x*x/4)+(z*z/4) < r*r ||
				(y*y/4)+(z*z/4) < r*r ) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	double x, y, z,v;
	cin >> x >> y >> z;
	v = min(max(x,y),min(max(x,z),max(y,z)));
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		double r;
		cin >> r;
		if (v > r*sqrt(2.0))
			cout << "NA" << endl;
		else
			cout << "OK" << endl;
	}
}