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<complex>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<deque>
#include<queue>
#include<climits>
#include<list>
#include<stack>
#include<ctime>
#define all(n) n.begin(),n.end()
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define F first
#define S second
#define pb push_back
#define INF (1<<27)
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> PP;
typedef unsigned long long ull;
typedef long long ll;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};

class AOJ0107{
private:
  int w,d,h;
  double t_r,f_r,l_r;
public:
  AOJ0107(int w,int h,int d):w(w),h(h),d(d){
    t_r = sqrt(pow((double)w/2.0,2)+pow((double)h/2.0,2));
    f_r = sqrt(pow((double)h/2.0,2)+pow((double)d/2.0,2));  
    l_r = sqrt(pow((double)w/2.0,2)+pow((double)d/2.0,2));  
  }
  ~AOJ0107(){}

  bool judge(double sp){
    if(sp-t_r > EPS)return true;
    if(sp-f_r > EPS)return true;
    if(sp-l_r > EPS)return true;
    return false;
  }

  void run(){
    int cnt;
    cin >> cnt;
    rep(i,cnt){
      int rect;
      cin >> rect;
      if(judge(rect))cout << "OK" << endl;
      else cout << "NA" << endl;
    }

  }



};


int main(){

  while(true){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c == 0)break;
    AOJ0107 ans = AOJ0107(a,b,c);
    ans.run();
  }
return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	long long 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 <stdio.h>

using namespace std;

int main() {
	long long int x,y,z,d,r[10001];
	int n,i;
	while(cin >> x >> y >> z) {
		if (x+y+z==0) break;
		cin >> n;
		for (i=0;i<n;i++) cin >> r[i];
        d=min(x*x+z*z,min(x*x+y*y,y*y+z*z));
        for (i=0;i<n;i++) if (4*r[i]*r[i]>d) cout << "OK" << endl; else cout << "NA" << endl;
	} 
    return 0;
	}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void){
	long int a[3],n;
	long double d;
	cin >> a[0] >> a[1] >> a[2];
	d = sqrt((double)a[0]*a[0]+(double)a[1]*a[1])/2;
	sort(a,a+3);
	cin >> n;
	REP(i,n){
		long int r;
		cin >> r;
		if (r>d)
			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++)
#define EPS 1e-6
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 = v[0]*v[0] + v[1]*v[1];

		int n;
		cin >> n;

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

			r *= 2;
			r *= r;

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

		}
	}
	return 0;
}

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

int main(){
  std::vector<int> size[3];
  int x, n, r;
  
  std::cin >> x;
  size[0] = x;
  std::cin >> x;
  size[1] = x;
  std::cin >> x;
  size[2] = x;
  size.sort(size.begin(), size.end());
  
  while(d!=0 && w!=0 && h!=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;
      }
    }
  }
  
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
using namespace std;
int main(){
	
	vector<int> s(3);
	int n;
	int r;
	while(cin>>s[0]>>s[1]>>s[2],s[0]!=0&&s[1]!=0&&s[2]!=0){
		sort(s.begin(),s.end());
		double a=sqrt(pow(s[0],2)+pow(s[1],2));
		cin>>n;
		double r;
		for(int i=0;i<n;i++){
			cin>>r;
			if(a<2*r)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

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

using namespace std;

int mini_1(int i, int j, int k){
	if(i <= j && i <= k){
		return i;
	}else if(j <= i && j <= k){
		return j;
	}else{
		return k;
	}
}

int mini_2(int i, int j, int k){
	if(i <= j && j <= k){
		return j;
	}else if(k <= j && j <= i){
		return j;
	}else if(i <= j && k <= i){
		return i;
	}else if(j <= i && i <= k){
		return i;
	}else{
		return k;
	}
}

int main(){
	
	int a, b, c, n, min1, min2, r;
	
	cin >> a >> b >> c;
	
	while(a != 0 || b != 0 || c != 0){
		
		min1 = mini_1(a, b, c);
		min2 = mini_2(a, b, c);
		
		cin >> n;
		
		for(int i = 0; i < n; i++){
			cin >> r;
			if(4 * r * r > min1 * min1 + min2 * min2){
				printf("OK\n");
			}else{
				printf("NG\n");
			}
		}
		
		cin >> a >> b >> c;
	}
	
	return 0;
}

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

int a, b, c;
int n, r;

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

C++: #include<stdio.h>

int main(void)
{
	int a[3],k,min1,min2,r,i,j,t;

	while(0==0)
	{
		scanf("%d %d %d",&a[0],&a[1],&a[2]);
		if(a[0]==0 && a[1]==0 && a[2]==0)break;//終了条件
		for(i=0;i<2;i++){
			for(j=i+1;j<3;j++){
			if(a[i]>a[j]){
				t=a[i];
				a[i]=a[j];
				a[j]=t;
			}
			}
		}
	    scanf("%d",&k);
		while(k!=0)
		{
			scanf("%d",&r);
			if((r*r) > (a[0]*a[0])+(a[1]*a[1])/4)//対角線の長さは√（縦＾２＋横＾２）
				printf("OK\n");//半径がチーズの中心から角の距離よりも短い
			else
				printf("NA\n");
			k--;
		}
	}
	return 0;
}

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

int main()
{
	int temp,c,i,f;
	double r,x,y,z;
	cin>>x>>y>>z;

	if(x>y){
		temp=x;
		x=y;
		y=temp;
	}
	if(y>z){
		temp=y;
		y=z;
		z=temp;
	}

	r=sqrt(pow(x/2,2)+pow(y/2,2));

	cin>>c;
	for(i=0;i<c;i++){
		cin>>f;
		if(r<=f)
			cout<<"OK\n";
		else cout<<"NA\n";
	}
}

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