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++: //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;
	LL a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	sort(a,a+3);
	LL bd=a[1]*a[1]+a[0]*a[0];
	int cnt=0;
	while(cnt<N){
		LL t;
		cin>>t;
		if(t*t*4>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 <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
 
int main(){
 
    double d,w,h,r,min_dist,dist1,dist2,dist3;
    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);
            dist1 = (sqrt(d*d+w*w))/2.0;
            dist2 = (sqrt(w*w+h*h))/2.0;
            dist3 = (sqrt(d*d+h*h))/2.0;
            min_dist = min(dist1,min(dist2,dist3));
            if(r > min_dist){
                printf("OK\n");
            }else{
                printf("NA\n");
            }
        }
    }
 
    return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int n, r, d, w, h, x;
	while (1) {
		cin >> d >> w >> h;
		if (d + w + h == 0)
			return 0;
		if (d <= h && w <= h)
			x = d * d + w * w;
		else if (d <= w && h <= w)
			x = d * d + h * h;
		else if (w <= d && h <= d)
			x = w * w + h * h;
		cout << x;
		cin >> n;
		for (int lop = 0; lop < n; lop++) {
			cin >> r;
			if (4*r*r > x)
				cout << "OK\n";
			else
				cout << "NA\n";
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int edge[3];
  while(cin >>edge[0]>>edge[1]>>edge[2],edge[0]||edge[1]||edge[2]){
    int n;
    cin >>n;
    sort(edge,edge+3);
    while(n--){
      int x;
      cin >>x;
      if(edge[0]*edge[0]+edge[1]*edge[1]<x*x*4){cout <<"OK"<<endl;}
      else{cout <<"NA"<<endl;}
    }
  }
  return 0;
}

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

using namespace std;

int main(void) {
	int size[3];

	while (cin >> size[0] >> size[1] >> size[2]) {
		if (size[0] == 0 && size[1] == 0 && size[2] == 0) {
			break;
		}
		std::sort(size, size + 3);

		// 直方体の最小面の対角線
		double diagonal = sqrt(pow(size[0], 2) + pow(size[1], 2));
		int num_entries, r;

		cin >> num_entries;

		for (int i = 0; i < num_entries; i++) {
			cin >> r;
			cout << (r * 2 > diagonal ? "OK" : "NA") << endl;
		}
	}
}

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

int main() {
  for (int x, y, z; cin >> x >> y >> z, x; ) {
      if (y > z) swap(y, z);
      if (x > y) swap(x, y);
      if (y > z) swap(y, z);

      int T; cin >> T;
      while(T--) {
          int r; cin >> r;
          if (4 * r * r > x * x + y * y)
              cout << "OK" << endl;
          else
              cout << "NA" << endl;
      }
  }
  return 0;
}

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

int main()
{
	int a,b,c,r,n,t;
	while(cin >> a >> b >> c, (a||b||c))
	{
		if(a>b) swap(a,b);
		if(a>c) swap(a,c);
		if(b>c) swap(b,c);

		r = a*a + b*b;

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

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    array<int, 3> v{};
    while(cin >> v[0] >> v[1] >> v[2], v[0]){
        int n;
        cin >> n;
        sort(v.begin(),v.end());
        for (int i = 0; i < n; ++i) {
            int r; cin >> r;
            if(v[0]*v[0]+v[1]*v[1] < 4*r*r) puts("OK");
            else puts("NA");
        }
    }
    return 0;
}

C++: #include<math.h>
#include<algorithm>
#include<iostream>

using namespace std;

int main(){
	int size[3];
	int n,r;
	int i;
	
	while(1){
	 for(i=0;i<3;i++){cin>>size[i];}
	 if(!(size[0]||size[1]||size[2])){break;}
	 sort(size,size+3);
	 
	 cin>>n;
	 for(i=0;i<n;i++){
	  cin>>r;
	  if(pow(size[0],2)+pow(size[1],2)<4*pow(r,2)){cout<<"OK\n";}else{cout<<"NA\n";}
	 }
	}
	
	return 0;
}

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

int m[3];
void solve(){

}
int main(){
  while(cin >> m[0] >> m[1] >> m[2], m[0]||m[1]||m[2]){
    sort(m, m+2);
    double d = sqrt(m[0]*m[0]+m[1]*m[1]);
    int n;
    cin >> n;
    while(n--){
      double r;
      cin >> r;
      cout << (d<(r*2.)?"OK":"NA") << endl;
    }
  }
  
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, c, n;
	float tmp;
	
	while(1){
		cin >> a >> b >> c;
		if(a == 0){
			break;
		}
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> tmp;
			tmp = tmp*tmp*3.1415/2.0;
			if(tmp > a*b || tmp > b*c || tmp > c*a){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}