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 <cmath>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

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

using namespace std;

int main() {
    int n;
    vector<int> s(3);

    while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
        sort(s.begin(), s.end());

        // REP(i, 3) cout << s[i] << " ";
        // cout << endl;

        double size = sqrt(s[0] * s[0] + s[1] * s[1]);

        // cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;

        REP(i, n) {
            double r;
            cin >> r;
            // cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
            if ( r * 2 <= size )
                cout << "NA";
            else
                cout << "OK";
            cout << endl;

        }

    }

    return 0;
}

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


int main(){
    int i;
    
    int size[3];
    cin >> size[0] >> size[1] >> size[2];
    int NumOfHole;
    cin >> NumOfHole;
    int *radius;
    radius = new int[NumOfHole];
    for(i=0;i<NumOfHole;i++){
        cin >> radius[i];
    }
    int check[3];
    cin >> check[0] >> check[1] >> check[2];
    if(check[0]!=0 || check[1]!=0 || check[2]!=0){
        cout << "Misloading\n";
        return 0;
    }
    
    int max;
    int vmax=0;
    for(i=0;i<3;i++){
        if(vmax < size[i]){
            vmax=size[i];
            max=i;
        }
    }
    int obst=0;
    for(i=0;i<3;i++){
        if(i!=max){
            obst += size[i]*size[i];
        }
    }
    for(i=0;i<NumOfHole;i++){
        if(obst < 4*radius[i]*radius[i]){
            cout << "OK\n";
        }else{
            cout << "NA\n";
        }
    }
    
    return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	vector<int> args(3);
	while(cin>>args[0]>>args[1]>>args[2], args[0]||args[1]||args[2]){
		sort(args.begin(),args.end());
		int n;
		cin>>n;
		//double d  = args[0]*args[0] + args[1]*args[1];
		//cout<<args[0]<<":"<<args[1]<<endl;
		for(int x=0;x<n;++x){
			int r;
			cin>>r;
			double l = sqrt(2)*r;
			if(l>args[0] && l>args[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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

int main(){
	int x,y,z;
	while(1){
		cin >> x >> y >> z;
		if(x+y+z==0) break;
		int a = max(max(x,y),z);
		int b = min(min(x,y),z);
		int c = x+y+z-a-b;
		int l = b*b+c*c;
		int n;
		cin >> n;
		int s;
		for(int i=0;i<n;i++){
			cin >> s;
			if(s*s*4>l) cout << "OK" << endl;
			else        cout << "NA" << endl;
		}
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int p,a,b,c,i,n,x;
	while(1)
	{
	scanf("%d %d %d",&a,&b,&c);
	if(a==0)return 0;
	if(a<c){
		p=a;
		a=c;
		c=a;
	}
	if(a<b){
		p=a;
		a=b;
		b=a;
	}
	double r=sqrt(b*b+c*c);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		if(r<(double)x*2)printf("OK\n");
		else printf("NG\n");
	}
	}
}

C++: #include <iostream>
int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}

C++: #include<iostream>
using namespace std;
int main(){
  int n,tate,yoko,high,hole,large;
  while(1){
    cin >> tate >> yoko >> high;
    if(tate==0 && yoko==0 && high==0){
      break;
    }
    cin >> n;
    if(tate>=yoko && tate>=high){
      large=tate;
    }
    else if(yoko>=tate && yoko>=high){
      large=yoko;
    }
    else if(high>=tate && high>=yoko){
      large=high;
    }
    for(int i=0;i<n;i++){
      cin >> hole;
      hole=hole*2;
      if(hole>large){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
  return (0);
}

C++: /* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 
                                                           
*/
/* }}} */

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

// #define int long long

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define print(x) cout << x << '\n'
#define Fi first
#define Se second

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define DEPS(i, a, n) for (int i = (a); i >= n; i--)
#define DEP(i, n) for (int i = (n); i >= 0; i--)

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;

/* const */
const int INF = 999999999;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

/* func */
inline bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
inline bool inside(int y, int x, int H, int W) {return (y >= 0 && x >= 0 && y < H && x < W);}

/* }}} */

signed main()
{
  ios::sync_with_stdio(false);
  int a, b, c;

  while (cin >> a >> b >> c, a || b || c){
    int dia[3] = {sqrt(a * a + b * b), sqrt(b * b + c * c), sqrt(c * c + a * a)};
    int n;
    cin >> n;
    int m = *min_element(dia, dia + 3);
    REP(i, n){
      int r;
      cin >> r;
      if (r * 2 > m) print("OK");
      else print("NA");
    }
  }

  return (0);
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back

int t, y, h, n;

void solve() {
  vector<int> s;
  s.pb(t); s.pb(y); s.pb(h);
  sort(s.begin(), s.end());
  double d1 = s[0] / 2.0;
  double d2 = s[1] / 2.0;
  cin>>n;
  rep(i,n) {
    double r; cin>>r;
    if (r*r > d1*d1 + d2*d2) {
      cout<<"OK"<<endl;
    } else {
      cout<<"NA"<<endl;
    }
  }
}

int main (int argc, char const* argv[]) {
  while (cin>>t>>y>>h, t||y||h) {
    solve();
  }
  return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int w, l, h;
	int n;
	int i;
	int x;
	
	while (1){
		scanf("%d %d %d", &w, &l, &h);
		if (w == 0 && l == 0 && h == 0)break;
		
		if (w > h){
			w += h;
			h = w - h;
			w -= h;
		}
		if (l > h){
			l += h;
			h = h -l;
			l -= h;
		}
		scanf ("%d", &n);
		
		for (i = 0; i < n; i++){
			scanf("%d", &x);
			
			if (w * l <= x * x / 2 * 3.141592){
				printf("OK\n");
			}else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

C++: #include <iostream>
int a,b,c,n,r;int main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}