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

using namespace std;

void solve()
{
	vector<int> size(3);
	while(cin >> size[0] >> size[1] >> size[2], size[0] || size[1] || size[2])
	{
		sort(size.begin(), size.end());
		double diagonal = sqrt((double)size[0] * size[0] + size[1] * size[1]);
		int n;
		cin >> n;
		for(int i = 0; i < n; ++i)
		{
			int a;
			cin >> a;
			if(2 * a > diagonal)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: 

#include<iostream>

using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;
int n;
while(cin >> w >> h >> d){
cin >> n;
while(n--){
cin >> r;
s=r*r*pi;
if(w*h<s||h*d<s||d*w<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
}

C++: #include <iostream>

using namespace std;

void solve()
{
	int length, width, height;
	while(cin >> length >> width >> height)
	{
		if(!length && !width && !height)
		{
			break;
		}
		int max = length;
		if(max < width)
		{
			max = width;
		}
		if(max < height)
		{
			max = height;
		}
		max /= 2;
		int n;
		cin >> n;
		while(n--)
		{
			int size;
			cin >> size;
			if(max < size)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: //Name: Carry a Cheese
//Level: 2
//Category: 数学,幾何
//Note:

/**
 * 直方体のどれかの面をまっすぐ入口に押しこむように入れるのが最適。
 * このとき、入口に平行な面の対角線の長さが、入口の直径よりも小さければ運び込むことができる。
 * 浮動小数点数を使うと誤差が怖いので、長さを2乗して扱うことで整数で判定する。
 *
 * オーダーは O(N)。
 */
#include <iostream>
#include <algorithm>

using namespace std;

bool solve() {
    long long A, B, C;
    cin >> A >> B >> C;
    if(!A && !B && !C) return false;

    const long long diag = min({A*A+B*B, A*A+C*C, B*B+C*C});
    int N;
    cin >> N;
    while(N--) {
        long long R;
        cin >> R;
        cout << (4*R*R > diag ? "OK" : "NA") << endl;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);

    while(solve()) ;
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int d, w, h;
  while (cin >> d >> w >> h, d) {
    if (d < w) swap(d, w);
    if (w < h) swap(w, h);
    if (d < w) swap(d, w);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      int r;
      cin >> r;
      cout << (w * w + h * h < 4 * r * r ? "OK" : "NA") << endl;
    }
  }

  return 0;
}

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

int main(){
    double x, w, h, n, r, min_r;
    while (cin >> x >> w >> h, x || w || h){
	min_r = min(sqrt(x*x+w*w), min(sqrt(x*x+h*h), sqrt(w*w+h*h)));
	cin >> n;
	while (n--){
	    cin >> r;
	    r*=2;
	    min_r < r ? cout << "OK" << endl; : cout << "NA" << endl;
	}
    }
}

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