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<stdio.h>
#include<math.h>

int main()
{
	int yoko,tate,high;
	int n,i,j,temp;
	int hole[10000];
	
	double taikaku;
	
	for(;;){
		scanf("%d%d%d",&tate,&yoko,&high);
		if(tate==0)break;
		
		taikaku=sqrt(yoko*yoko+high*high);
		
		scanf("%d",&n);
		
		for(i=0;i<n;i++){
			scanf("%d",&temp);
			hole[i]=temp*2;
		}
		
		for(i=0;i<n;i++){
			if(hole[i]>taikaku)puts("OK");
			if(hole[i]<taikaku)puts("NA");
			if(hole[i]==taikaku)puts("NA");
		}
		
		
	}
	return 0;
}

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

class Cheese{
private:
	int x;
	int y;
	int z;
public:
	double gr[3];

	double CalcGr(int x, int y){
		return sqrt((double)(x*x + y*y)) / 2;
	}

	Cheese(){
//		scanf("%d %d %d", &x, &y, &z);
		std::cin >> x >> y >> z;
		gr[0] = CalcGr(x, z);
		gr[1] = CalcGr(x, y);
		gr[2] = CalcGr(y, z);
	}
};

int main(){
	Cheese c;
	
	int n;
//	scanf("%d", &n);
	std::cin >> n;

	int r;
	for (int i = 0; i < n; i++){
//		scanf("%d", &r);
		std::cin >> r;
		if (c.gr[0] < r || c.gr[1] < r || c.gr[2] < r){
			printf("OK\n");
		}
		else{
			printf("NA\n");
		}
	}

	return 0;
}

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

using namespace std;

int main() {
	while (1) {
		double edges[3];
		cin >> edges[0] >> edges[1] >> edges[2];

		if (edges[0] == 0 && edges[1] == 0 && edges[2] == 0){ 
      break;
    }

    double p_c1 = pow(edges[1],2.0);
    double p_c2 = pow(edges[2],2.0);
    double cheese = p_c1 + p_c2;
    double c_cheese = sqrt(cheese);

		int n;
		cin >> n;
		
		for (int i = 0; i < n; i++) {
			double r;
			cin >> r;
      double s = r * 2.0;
		
      if(c_cheese < s){
			  cout<<"OK"<<endl;
      }
      else{
        cout<<"NA"<<endl;
      }
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int in1, in2, in3;
	while (true) {
		cin >> in1 >> in2 >> in3;
		if (in1 == 0 && in2 == 0 && in3 == 0) { break; }
		vector<int>a;
		a.pb(in1);
		a.pb(in2);
		a.pb(in3);

		Sort(a);
		int n;
		cin >> n;
		ld save = sqrt(a[0] * a[0] + a[1] * a[1]) / 2.00;
		rep(i, n) {
			ld r;
			cin >> r;
			if (r > save) { cout << "OK" << endl; }
			else { cout << "NA" << endl; }
		}
		return 0;
	}
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main()
{
  while(true)
    {
      int x,y,z;
      cin>>x>>y>>z;
      if(x==0 && y==0 && z==0)break;
      int n;
      cin>>n;
      for(int i=0;i<n;i++)
	{
	  int r;
	  cin>>r;
	  if(sqrt(pow((double)x/2,2)+pow((double)y/2,2))<r)cout<<"OK"<<endl;
	  else if(sqrt(pow((double)y/2,2)+pow((double)z/2,2))<r)cout<<"OK"<<endl;
	  else if(sqrt(pow((double)x/2,2)+pow((double)z/2,2))<r)cout<<"OK"<<endl;
	  else cout<<"NA"<<endl;
	}
    }
  return 0;
}

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

void judge(int x, int y, int z, int r);

int main(void)
{
    int cheese_x, cheese_y, cheese_z;
    scanf("%d", &cheese_x);
    scanf("%d", &cheese_y);
    scanf("%d", &cheese_z);
    int n;
    int cnt;
    scanf("%d", &n);
    for(cnt = 0; cnt < n; cnt++){
        int hole_size;
        scanf("%d", &hole_size);
        judge(cheese_x, cheese_y, cheese_z, hole_size);
    }
    return 0;
}

void judge(int x, int y, int z, int r)
{
    int d_1, d_2, d_3;
    d_1 = (x / 2) * (x / 2) + y * y;
    d_2 = (y / 2) * (y / 2) + z * z;
    d_3 = (z / 2) * (z / 2) + x * x;
    if(d_1 < r || d_2 < r || d_3 < r){
        printf("OK");
    } else {
        printf("NA");
    }
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	double a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	double bd=sqrt(a[0]*a[0]+a[1]*a[1]);
	int cnt=0;
	while(cnt<N){
		double t;
		cin>>t;
		if(t*2.0>bd)res.PB("OK");
		else res.PB("NA");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

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

int main(void)
{
  int cheese_size;
  int length[3]; /* height, width, breadth */
  int n;
  int door_size, redius;
  
  while(1)
    {
      cin >> length[0] >> length[1] >> length[2];
      if(length[0] == 0 && length[1] == 0 && length[2] == 0) break;
      sort(length, length + 3);
      cheese_size = length[0] * length[0] + length[1] * length[1]; 
      
      cin >> n;
      
      for(int i = 0 ; i < n ; i++)
	{
	  cin >> redius;
	  door_size = (2 * redius) * (2 * redius); /* ツ陳シツ径 x ツ陳シツ径ツ。ツ青ウツ陛サツ形 */
	  
	  if(cheese_size < door_size) cout << "OK" << endl;
	  else cout << "NA" << endl;
	}
    }
  return 0;
}