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

using namespace std;

int main(){
  while(1){
    int a[3];
    scanf("%d%d%d", a, a+1, a+2);
    if(a[0]==0&a[1]==0&a[2]==0) break;

    sort(a, a+3);

    int t = (a[0]*a[0]+a[1]*a[1]);

    int n;
    scanf("%d", &n);

    for(int i=0;i<n;i++){
      int k;
      scanf("%d", &k);
      printf("%s\n", (4*k*k > t)? "OK":"NA");
    }
  }
}

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return 0;
	}
#endif
	/*****変数置き場*****/
	int c_v,c_h,c_w;
	int n;
	int e_r;
	/*****処理部*****/
	while(1){
		cin >> c_v >> c_w >> c_h;
		if(c_v == 0 && c_w == 0 && c_h == 0)	break;
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> e_r;
			if((c_v*c_v + c_w*c_w) < (e_r*2 * e_r*2)){
				//cout << c_v*c_v + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else if((c_v*c_v + c_h*c_h) < (e_r*2 * e_r*2)){
				//cout << c_v*c_v + c_h*c_h << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else if((c_h*c_h + c_w*c_w) < (e_r*2 * e_r*2)){
				//cout << c_h*c_h + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "OK" << endl;
			}else{
				//cout << c_v*c_v + c_w*c_w << " " << e_r*2 * e_r*2 << endl;
				cout << "NA" << endl;
			}
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,tate,yoko,high,hole,large;
  while(1){
    cin >> tate >> yoko >> high;
    if(tate==0 && yoko==0 && high==0){
      break;
    }
    cin >> n;
    if(tate>=yoko && tate>=high){
      large=tate;
    }
    else if(yoko>=tate && yoko>=high){
      large=yoko;
    }
    else if(high>=tate && high>=yoko){
      large=high;
    }
    cout << large << endl;
    for(int i=0;i<n;i++){
      cin >> hole;
      hole=hole*2;
      if(hole>large){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
  return (0);
}

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

int main(){
	int h,w,d,n,a;
	while(cin >> h >> w >> d,h){
		cin >> n;
		for(int i = 0;i < n;++i){
			cin >> a;
			if(a >= h || a >= w || a >= d){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {

	while (true) {
		VI c(3); rep(i, 3)cin >> c[i];
		if (c[0] == 0 && c[1] == 0 && c[2] == 0)break;

		sort(all(c));
		double max = hypot((double)c[0] / 2., (double)c[1] / 2.);
		
		int n; cin >> n;
		rep(i, n) {
			double r; cin >> r;
			puts(r > max ? "OK" : "NA");
		}
	}
}

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+2);
    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<cmath>
#include<algorithm>
using namespace std;

int main() {
	int d[3];
	while (cin >> d[0] >> d[1] >> d[2], d[0], d[1], d[2]) {
		int n;
		cin >> n;
		sort(d, d + 3);
		double c = sqrt(d[0] * d[0] + (d[1] * d[1]));
		for (int i = 0;i < n;i++) {
			int a;
			cin >> a;
			if (a*2 > c)cout << "OK" << endl;
			else cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

double f(int a, int b){ return sqrt(a*a + b*b) / 2.0; }

int main(){
  int x,y,z;
  while(cin>>x>>y>>z, x+y+z){
    double m = 1e10;
    m = min(m, f(x,y));
    m = min(m, f(y,z));
    m = min(m, f(x,z));
    //printf("m = %f\n",m);
    int n; cin>>n;
    while(n --> 0){
      double r; cin >> r;
      puts(r > m ? "OK" : "NA");
    }
  }
  return 0;
}

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

int main(){
	int a, b, c;
	while(cin >> a >> b >> c, a+b+c){
		if(a > b){
			swap(a, b);
		}
		if(b > c){
			swap(b, c);
		}
		int n;
		cin >> n;
		int size_sq = a*a+b*b;
		while(n--){
			int r;
			cin >> r; 
			if(4*r*r > size_sq){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

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

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		double dis = sqrt(v[0]*v[0] + v[1]*v[1]);
		dis /= 2;

		int n;
		cin >> n;

		while(n--)
		{
			double r;
			cin >> r;

			if(dis < r)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}

		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int data[3],n,a;
	while(1){
		for(int i=0;i<3;i++){
			cin>>data[i];
		}
		if(data[0]==0)break;
		cin>>n;
		sort(data,data+3);
		for(int i=0;i<n;i++){
			cin>>a;
			if(2*a*2*a>data[0]*data[0]+data[1]*data[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

int main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		ll v = -max( max(a * a, b * b), c * c ) + a * a + b * b + c * c;
		int n; cin >> n;
		for (int i = 0; i < n; ++i) {
			ll r; cin >> r;
			r *= 2;
			r *= r;
			if (r > v) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}