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 <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  double w[3];
  while(cin >> w[0] >> w[1] >> w[2] && w[0]){
    sort(w,w+3);
    double R = sqrt((w[0]*w[0]+w[1]*w[1])/4);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
      double r;
      cin >> r;
      cout << (R<r?"OK":"NA") << endl;
    }
  }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	vector<double>a(3);
	while(cin>>a[0]>>a[1]>>a[2],a[0]){
		sort(all(a));
		double r=hypot(a[0],a[1])/2;
		int n;
		cin>>n;
		rp(n){
			int m;cin>>m;
			if(m>r)cout<<"OK"<<endl;
			else cout<<"NG"<<endl;
		}
	}
}

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

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		if (!a && !b && !c)break;
		int d;
		cin >> d;
		if (b > a) {
			for (int e = 0; e < d; e++) {
				int f;
				cin >> f;
				if (f * 2>b)cout << "OK" << endl;
				else cout << "NA" << endl;
			}
		}
		else {
			for (int e = 0; e < d; e++) {
				int f;
				cin >> f;
				if (f * 2>a)cout << "OK" << endl;
				else cout << "NA" << endl;
			}
		}
	}
}

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

using namespace std;

int main(){
  int a,b,c;
  int n;

  while(1){
    //a,b,cの入力
    /*    char line[100];
    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d %d",&a,&b,&c);
    */

    scanf("%d %d %d",&a,&b,&c);
    //a=b=c=0 なら終了
    if(a==0&&b==0&&c==0){
      break;
    }

    //対角線の半分を求め、その最大値を求める
    double d[3];
    d[0]=sqrt(a*a+b*b)/2;
    d[1]=sqrt(b*b+c*c)/2;
    d[2]=sqrt(c*c+a*a)/2;
    double maxd=d[0];
    for(int i=0;i<2;i++){
      if(maxd<d[i]) maxd=d[i];
    }

    //nの入力
    cin>>n;

    //rの入力、判定
    for(int i=0;i<n;i++){
      double r=0;
      cin>>r;
      if(maxd<r){
	cout<<"OK\n";
      }
      else{
	cout<<"NA\n";
      }
    }
  }
  return 0;
}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> size[0];
  std::cin >> size[1];
  std::cin >> size[2];
  std::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<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    double a[3];
    int b,c;
    cin>>a[0]>>a[1]>>a[2];
    if(a[0]==0&&a[1]==0&&a[2]==0)break;
    sort(a,a+3);
    cin>>b;
    for(int i=0;i<b;i++){
      cin>>c;
      if(c*2>sqrt(pow(a[0],2)+pow(a[1],2)))printf("OK\n");
      else printf("NA\n");
    }
  }
  return 0;
}

C++: //include----------------------------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < n; i++)
#define FOR(i, s, n) for(int i = s; i < n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << endl
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define FOREACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#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())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;

//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int w, h, high;
int r;
int n;

//function---------------------------------------------------------------------------------------------------------------------
int main() {
    while(scanf("%d %d %d", &w, &h, &high)){
        if(w == 0 && h == 0 && high ==0)
            break;
        scanf("%d", &n);
        rep(i, n){
            scanf("%d", &r);
            if(w >= r * 2 || h >= r * 2 || high >= r * 2)
                printf("NA\n");
            else
                printf("OK\n");
        }
    }
    return 0;
}

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

int main() {
  vector<int> side(3);  // ???, ?¨?, ??????
  int n;                // ??\??£????????°
  int rad;              // ??\??£?????????
  int diagonal;         // ????§?????????????
  string ans[2] = { "NG", "OK" }; // ??????
  while(1) {
    cin >> side[0] >> side[1] >> side[2];
    if (side[0] + side[1] + side[2] == 0) break;
    // ????§????????¨????
    {
      sort(side.begin(), side.end());
      diagonal = sqrt(pow((double)side[0], 2) + pow((double)side[1], 2));
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> rad;
      cout << (rad*2 > diagonal ? "OK" : "NG") << endl;
    }
  }

}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int tate,yoko,takasa,mn,md;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mn=min(min(tate , yoko) , takasa);
		if(tate>=yoko){
			if(yoko>=takasa) {
			    md=yoko;
			} else if (yoko<takasa) {
				if(tate>=takasa)  md=takasa;
				else if (tate<takasa)  md=tate;
			}
			
		} else if (tate<yoko){
			if (tate>=takasa){
				md=tate;
			} else if(tate<takasa){
				if(yoko>=takasa) md=takasa;
				else if(yoko<takasa) md=yoko;
			}
		}
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mn*mn+md*md) ? "OK" : "NA") << endl;
		}
	}
	return 0; 
}