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++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

int main()
{
	long long int a[3];
	for (size_t i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	sort(a,a+3);
	a[2] = a[0] * a[0] + a[1] * a[1];
	int N;
	cin >> N;
	long long int x;
	for (size_t i = 0; i < N; i++)
	{
		cin >> x;
		x *= 2;
		if (x*x>a[2])
		{
			cout << "OK" << endl;
		} else
		{
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main(){

  int t=0,y=0,h=0,k,i,n,r;
  double c;
  while(cin>>t>>y>>h){
    if(t==0&&y==0&&h==0)break;
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    if(y<h){
      n=t;
      t=y;
      y=n;
    }
    if(t<y){
      n=t;
      t=y;
      y=n;
    }
    c=sqrt((t/2)*(t/2)+(y/2)*(y/2));
    cin>>k;
    for(i=0;i<k;i++){
      cin>>r;
      if(r>c){
	cout<<"OK"<<endl;
      }
      else{
	cout<<"NA"<<endl;
      }
    }
  }
  return 0;
}

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

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