Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		line := strings.Split(stdin.Text(), " ")
		len := []int{}
		for i := 0; i < 3; i++ {
			tmp, _ := strconv.Atoi(line[i])
			len = append(len, tmp)
		}
		if len[0] == 0 && len[1] == 0 && len[2] == 0 {
			break
		}
		sort.Ints(len)
		d2 := len[0]*len[0] + len[1]*len[1]
		stdin.Scan()
		n, _ := strconv.Atoi(stdin.Text())
		for i := 0; i < n; i++ {
			stdin.Scan()
			r, _ := strconv.Atoi(stdin.Text())
			if 4*r*r > d2 {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

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

int size[3],n,radius;
int d[10000];

int main(){
	while(std::cin>>size[0]>>size[1]>>size[2] ,(size[0]||size[1]||size[2]) ){
		std::sort(size,size+3);
		std::cin>>n;
		while( n-- ){
			std::cin>>radius;
			if( pow(radius*2,2) <= pow((float)size[0],2) + pow((float)size[1],2) )
				std::cout<<"NA"<<std::endl;
			else std::cout<<"OK"<<std::endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

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

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#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())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

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

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main() {
  int c[3], n;

  while(cin >> c[0] >> c[1] >> c[2], c[0]+c[1]+c[2]) {
    sort(c, c+3);
    int size = sqrt(c[0]*c[0] + c[1]*c[1]);
    cin >> n;
    REP(i, n) {
      int r;
      cin >> r;
      if(2*r > size) cout << "OK" << endl;
      else cout << "NA" << 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,mx,mn;
	int n;
	while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
		cin>>n;
		int* r = new int [n];
		mx=max(max(tate , yoko) , takasa);
		mn=min(min(tate , yoko) , takasa);
		for(int i=0;i<n;++i){
			cin>> r[i];
			cout << ((r[i]*r[i]*4>mx*mx+mn*mn) ? "OK" : "NA") << endl;
		}
	}
	return 0; 
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return b.second > a.second;
    }
    return a.first < b.first;
}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    double d, w, h;
    while (cin >> d >> w >> h)
    {
        if (d == 0 && w == 0 && h == 0)
            break;

        double dist = min({sqrt(h * h + w * w) / 2.0, sqrt(h * h + d * d) / 2.0, sqrt(w * w + d * d) / 2.0});
        int n;
        cin >> n;
        for (int i = 0; i < n; ++i)
        {
            double r;
            cin >> r;
            if (r > dist)
            {
                cout << "OK" << endl;
            }
            else
                cout << "NA" << endl;
        }
    }
    return 0;
}

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