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>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int number;
	cin>>number;
int r[100];
int n=0;

while(true){
	int temp;
	cin>>temp;
	if(n>=2&&temp==0&&r[n-1]==0&&r[n-2]==0){
		break;
	}
	else{
		r[n]=temp;
		n=n++;
	}
}
	int rec1,rec2,rec3;
	rec1=a*a+b*b;
	rec2=a*a+c*c;
	rec3=b*b+c*c;


	for (int i=0;i<(n-2);i++){
	 if (4*r[i]*r[i]>rec1||4*r[i]*r[i]>rec2||4*r[i]*r[i]>rec3){
		 cout<<"OK"<<endl;
	 }
	 else{
		 cout<<"NA"<<endl;
	 }
	}
return 0;

}

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

int main(){
  std::vector<int> size;
  int x, 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());
  
  while(size[0]==0 && size[1]==0 && size[2]==0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std::cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
    std::cin >> size[0];
    std::cin >> size[1];
    std::cin >> size[2];
    std::sort(size.begin(), size.end());
  }
  
  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 t = r * 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 < t || d_2 < t || d_3 < t){
        printf("OK\n");
    } else {
        printf("NA\n");
    }
}

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 << "NO" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main(int argc, char **argv)
{
	int n;
	float s, t, a[3];
	
	while(1){
		cin >> a[0] >> a[1] >> a[2];
		if(a[0] == 0){
			break;
		}
		sort(a, a+3);
		cin >> n;
		s = sqrt((a[1]*a[1])+(a[0]*a[0]));
		s /= 2;
		for(int i = 0; i < n; i++){
			cin >> t;
			if(t > s){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

void solve107(int d, int w, int h) {
    int n;
    cin >> n;
    int r;
    vector<int> v;
    v.push_back(d);
    v.push_back(w);
    v.push_back(h);
    sort(ALL(v));
    double lim = v[0]*v[0]/4.0 + v[1]*v[1]/4.0;
    REP(i,n) {
        cin >> r;
        if (lim < r*r) cout << "OK" << endl;
        else cout << "NA" << endl;
    }
}

int main() {
    int d, w, h;
    while (cin >> d >> w >> h, d + w + h) {
        solve107(d, w, h);
    }
    return 0;
}

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

#define loop for (;;)
#define repeat(i, n) for (int i = 0; i < (n); i++)

inline bool inside(double a, double b, int r) {
  return a*a+b*b < r*r;
}

using namespace std;

int main() {
  loop {
    double a, b, c;
    cin >> a >> b >> c;
    if (!(a || b || c)) return 0;
    a /= 2;
    b /= 2;
    c /= 2;
    int n;
    cin >> n;
    repeat(i, n) {
      int r;
      cin >> r;
      if (inside(a, b, r) || inside(b, c, r) || inside(c, a, r))
        cout << "OK" << endl;
      else
        cout << "NA" << endl;
    }
  }
}

C++: 
#include<iostream>
#include<cmath>
using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;
int n;
while(1){
cin >> w >> h >> d;
if(w+h+d==0) break;
cin >> n;
while(n--){
cin >> r;
r*=2;
double dw,dh,dd;
dw=sqrt(w*w+h*h);
dh=sqrt(h*h+d*d);
dd=sqrt(d*d+w*w);
if(dw<r||dh<r||dd<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int l,w,h,m,n,r;
  for(;;){
    cin >> l >> w >> h;
    if(l==0 && w==0 && h==0) break;
    if(max(l,max(w,h)) == l) m = w*w + h*h;
    else if(max(l,max(w,h)) == w) m = l*l + h*h;
    else m = l*l + w*w;
    cin >> n;
    while(n--){
      cin >> r;
      if((2*r)*(2*r) > m) 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<algorithm>
#include<cmath>
using namespace std;
int t[3];
double limit,r;
int n;
int main(){
  while(cin>>t[0]>>t[1]>>t[2]){
    if(t[0]==0)break;
    sort(t,t+3);
    limit=sqrt(t[0]*t[0]+t[1]*t[1]);
    cin>>n;
    while(n--){
      cin>>r;
      if(r*2>limit){
	cout<<"OK"<<endl;
      }else{
	cout<<"NA"<<endl;
      }
    }
  }
  return 0;
}

C++: #define scanf_s scanf
//#define sscanf_s sscanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1001
#define _MAX 100
#define HO 6
int main(void)
{
	while (1) {
		int d, w, h, n, r;
		scanf_s("%d %d %d", &d, &w, &h);
		if ((d == 0 && w == 0) && h == 0) break;
		scanf_s("%d", &n);
		for (int i = 0; i < n; ++i) {
			scanf_s("%d", &r);
			bool ny = false;
			if ((w < r * 2 && h < r* 2) && d < r * 2) {
				ny = true;
			}
			if (ny) 	printf("OK\n");
			else 	printf("NA\n");

		}
	}
}