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 <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

int main(void){
    for(vi l(3); cin >> l[0], l[0];){
        COUNT(i, 2) cin >> l[i];
        sort(ALL(l));
    
        int n; cin >> n;
        while(n --){
            int r; cin >> r;
            cout << ((pow(l[0] / 2, 2.) + pow(l[1] / 2, 2.) < pow(r, 2.)) ? "OK":"NA") << endl;
        }
    }
 
    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 << "NG" << endl;
			}
		}
	}
	
	return 0;
}

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

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

using namespace std;

int main() {

	int c[3];

	while(cin >> c[0] >> c[1] >> c[2]) {
		if(!c[0]&&!c[1]&&!c[2]) {
			break;
		}
		sort(c, c+2);
		double R=sqrt(pow((double)c[0], 2)+pow((double)c[1], 2));

		int n;
		cin >> n;
		while(n) {
			int r;
			cin >> r;
			cout << (2*r>R ? "OK" : "NA") << endl;
			n--;
		}
	}

	return 0;

}

C++: /*
	Carry a Cheese
*/
#include	<iostream>
#include	<cmath>

using namespace std;

int main(void) {
	while(1){
		int lx, ly, lz, n;
		double dxy, dyz, dzx;
		
		cin >> lx >> ly >> lz;
		
		if(lx == 0 && ly == 0 && lz == 0) { break; }
		
		dxy = sqrt(lx * lx + ly * ly);
		dyz = sqrt(ly * ly + lz * lz);
		dzx = sqrt(lz * lz + lx * lx);
		
		cin >> n;
		
		for(int i = 0; i < n; i++) {
			int r;
			
			cin >> r;
			r *= 2;
			if(r > dxy || r > dyz || r > dzx) {
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

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

#define EPS 1e-7

using namespace std;
int main(){
    vector<int> in(3);
    while(cin >> in[0] >> in[1] >> in[2]){
        sort(in.begin(),in.end());
        if(in[2] == 0)break;
        int n;
        cin >> n;
        double l = hypot(in[1], in[0]);
        for(int i = 0; i < n; i++){
            double r;
            cin >> r;
            if(l + EPS < r*2)cout << "OK" << endl;
            else cout << "NA" << endl;
        }
    }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(void){
	while( true ){
		int n;
		int x,y,z;
		
		cin >> x >> y >> z;
		if( x==0&&y==0&&z==0 ) break;
		cin >> n;

		for(int i = 0; i < n; i++){
			int r;
			
			cin >> r;
			if( sqrt((double)x*x+y*y) < 2*r ||
				sqrt((double)x*x+z*z) < 2*r ||
				sqrt((double)y*y+z*z) < 2*r ) cout << "OK\n";
			else cout << "NA\n";
		}
	}
	return 0;
}