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>
using namespace std;

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

  while(1){
    cin >> a >> b >> c;
    if(!a && !b && !c)break;

    cin >> n;
    for(int i=0;i<n;i++){
      cin >> ent;
      ent *= 2;
      flag = 0;
      if(a*a + b*b < ent*ent)flag = 1;
      if(b*b + c*c < ent*ent)flag = 1;
      if(c*c + a*a < ent*ent)flag = 1;
      if(flag)cout << "OK" << endl;
      else cout << "NA" << endl;
    }

  }
}

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

int main()
{
	double x,y,z;
	while(cin >> x >> y >> z){
		double r = min(sqrt(x*x+y*y),min(sqrt(y*y+z*z),sqrt(z*z+y*y)));
		if(!r)
			break;
		int n;
		cin >> n;
		for(int i=0;i<n;i++){
			int R;
			cin >> R;
			R += R;
			if(R >= r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main()
{
	int x,y,z;
	while(cin >> y >> x >> z && x)
	{
		double set=sqrt(x*x+z*z)/2;
		int n,r;
		cin >> n;
		while(n--)
		{
			cin >> r;
			if(set<r)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int a, b, c, n, r;
	while(1){
		cin >> a >> b >> c;
		if(a == 0 && b == 0 && c == 0){
			break;
		}
		cin >> n;
		while(n--){
			cin >> r;
			double x = sqrt(2.0) * r;
			if(x >= a && x >= b || x >= b && x >= c || x >= c && x >= a){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: // 2011/01/14 Tazoe

#include <iostream>
using namespace std;

void ABC_sort(int& A, int& B, int& C)
{
	int tmp[3] = {A, B, C};

	for(int i=0; i<2; i++)
		for(int j=i+1; j<3; j++)
			if(tmp[i]>tmp[j]){
				int swp = tmp[i];
				tmp[i] = tmp[j];
				tmp[j] = swp;
			}

	A = tmp[0];
	B = tmp[1];
	C = tmp[2];
}

int main()
{
	while(true){
		int A, B, C;
		cin >> A >> B >> C;
		if(A==0&&B==0&&C==0)
			break;

		ABC_sort(A, B, C);
		int D = A*A+B*B;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int R;
			cin >> R;
			if(D<4*R*R)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
	double a, b, c, d;
	while(cin >> a >> b >> c, a){

		d = sqrt(pow(min(a, min(b, c)), 2) + pow(a + b + c - min(a, min(b,c)) - max(a, max(b, c)), 2));
	
		int n;
		cin >> n;
		while(n--){
			int r;
			cin >> r;
			if(d < 2 * r)cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

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

int main(void)
{
	int a[3], n, b;
	while (scanf("%d %d %d", &a[0], &a[1], &a[2]), a[0]){
		sort(a, a + 3);
		int r = a[0]*a[0] + a[1]*a[1];
		cin >> n;
		for (int i = 0; i < n; i++){
			cin >> b;
			if (r < (b*2)*(b*2)) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  int edge[3],n;
  double x;
  while(cin >>edge[0]>>edge[1]>>edge[2],edge[0]||edge[1]||edge[2]){
    cin >>n;
    sort(edge,edge+3);
    x = sqrt(edge[0]*edge[0]+edge[1]*edge[1]);
    while(n--){
      double a;
      cin >>a;
      if(a*2>x){cout <<"OK"<<endl;}
      else{cout <<"NA"<<endl;}
    }
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int d,w,h,r,n,rd;
	while(cin>>d>>w>>h){
		if(d==0&&w==0&&h==0)break;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r;
		rd=r*2;
		if(d<rd&&w<rd&&h<rd){
			cout<<"OK"<<endl;
			continue;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int a, b, c, n, r;
	while(1){
		cin >> a >> b >> c;
		if(a == 0 && b == 0 && c == 0){
			break;
		}
		cin >> n;
		while(n--){
			cin >> r;
			double x = sqrt(2.0) * r;
			if(x > a && x > b || x > b && x > c || x > c && x > a){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1e7
int main(){
    ll d,w,h;
    while(cin >> d >> w >> h,d+w+h){
        int n; cin>>n;
        vi v (n+1,0);
        double pi = acos(-1.0);
        ll s = w*h;
        rep(i,n){
            cin >>v[i];
            double temp = v[i]*v[i]*pi;
            int r = 2*v[i];
            //cout << "temp : " << temp << "s :" << s << endl;
            if( d<r && w<r && h<r  && temp>s)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
            }
        }
    return 0;
}

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

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

C++: #include<stdio.h>
#include<math.h>

int main(void)
{
	int num,kosu;
	int nyuuryoku[3],x,y;
	int cut_i,cut_j,tem;
	int hankei;
	double z;

	while(1){
		scanf("%d%d%d",&nyuuryoku[0],&nyuuryoku[1],&nyuuryoku[2]);
		if((nyuuryoku[0]==0)&&(nyuuryoku[1]==0)&&(nyuuryoku[2]==0)){
			break;
		}

		for(cut_i=0;cut_i<kosu-1;cut_i++){
			for(cut_j=cut_i;cut_j<kosu;cut_j++){
				if(nyuuryoku[cut_i]>nyuuryoku[cut_j]){
					tem=nyuuryoku[cut_i];
					nyuuryoku[cut_i]=nyuuryoku[cut_j];
					nyuuryoku[cut_j]=tem;
				}
		    }
		}
		x=nyuuryoku[1];
		y=nyuuryoku[2];
		
		z = sqrt((double)(x*x) + (double)(y*y));

		scanf("%d",&kosu);
		
		for(cut_i=0;cut_i<kosu;cut_i++){
			scanf("%d",&hankei);
			if(z>=(double)hankei){
				printf("OK\n");
			}
			else {
				printf("NA\n");
			}
		}

	}
	return 0;
}

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

int main(){
	int h,w,d,n,a;
	while(cin >> h >> w >> d,h){
		cin >> n;
		for(int i = 0;i < n;++i){
			cin >> a;
			if(a >= sqrt(h * h + w * w) || a >= sqrt(d * d + w * w) || a >= sqrt(h * h + d * d) || a >= h || a >= w || a >= d){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}