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 <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;
		}
	}
	delete [] r;
	return 0; 
}

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

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int main(){
	int x,y,h;
	int m,n,t,c=0;

	cin >> x >> y >> h >> n;
	
	//detect most small surface
	m = x*y;
	if(m>x*h)m = x*h;
	if(m>y*h)m = y*h;

	for(int i=0;i<n;i++){
		cin >> t;

		if(t==0){
			if(++c==3){
				break;
			}
		}

		if(m<2*t*t){
			if((t*R>x&&t*R>y)||(t*R>x&&t*R>h)||(t*R>h&&t*R>y)){
				cout << "OK";
			}else{
				cout << "NA";
			}
		}else{
			cout << "NA";
		}

		cout << endl;
	}

	return 0;
}

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

int m[3];
void solve(){

}
int main(){
  while(cin >> m[0] >> m[1] >> m[2], m[0]||m[1]||m[2]){
    sort(m, m+2, greater<int>());
    double d = sqrt(m[0]*m[0]+m[1]*m[1]);
    int n;
    cin >> n;
    while(n--){
      double r;
      cin >> r;
      r = 2.*r;
      cout << (d<=r?"OK":"NA") << endl;
    }
  }
  
  return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#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())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define INF 1000000


int dp[102];
int main(){
	int N;
	long a[3];
	cin>>a[0]>>a[1]>>a[2];
	cin>>N;
	vector<string> res;
	//sort(a,a+3);
	long bd=a[1]*a[1]+a[2]*a[2];
	int cnt=0;
	while(cnt<N){
		long t;
		cin>>t;
		if(t*t*4>bd)res.PB("OK");
		else res.PB("NA");
		cnt++;
	}
	cin>>a[0]>>a[1]>>a[2];
	REP(i,SZ(res))cout<<res[i]<<endl;
	
	return 0;
}

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

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int main(){
	int x,y,h;
	int m,n,c=0;
	int r[10000];
	float t;

	cin >> x >> y >> h >> n;

	//detect most small surface
	m = x*y;
	if(m>x*h)m = x*h;
	if(m>y*h)m = y*h;

	for(int i=0;i<n;i++){
		cin >> t;

		if(t==0){
			if(++c==3){
				break;
			}
		}

		if(m<2*t*t){
			if((t*R>x&&t*R>y)||(t*R>x&&t*R>h)||(t*R>h&&t*R>y)){
				r[i] = 1;
			}else{
				r[i] = 0;
			}
		}else{
			r[i] = 0;
		}
	}


	for(int i=0;i<n;i++){
		if(r[i]==0){
			cout << "NA" << endl;
		}else{
			cout << "OK" << endl;
		}
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, c, n, tmp;
	
	while(1){
		cin >> a >> b >> c;
		if(a == 0){
			break;
		}
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> tmp;
			if(tmp >= a || tmp >= b || tmp >= c){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-6
using namespace std;

int main()
{
	vector<int> v;
	int a[3];
	while(true)
	{
		cin >> a[0] >> a[1] >> a[2];
		if(a[0] == 0 && a[1] == 0 && a[2] == 0)
		{
			break;
		}

		rep(i,3)
		{
			v.push_back(a[i]);
		}

		sort(v.begin(),v.end());
		int dis = v[0]*v[0] + v[1]*v[1];
		cout << dis << endl;

		int n;
		cin >> n;

		while(n--)
		{
			int r;
			cin >> r;

			r *= 2;

			if(dis < r*r)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}

		}
	}
	return 0;
}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  //std::cin >> x;
  //size[0] = x;
  //std::cin >> x;
  //size[1] = x;
  //std::cin >> x;
  //size[2] = x;
  std::sort(size.begin(), size.end());
  
  while(size[0]==0 && size[1]==0 && size[2]==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;
      }
    }
    //std::cin >> x;
    //size[0] = x;
    //std::cin >> x;
    //size[1] = x;
    //std::cin >> x;
    //size[2] = x;
    std::sort(size.begin(), size.end());
  }
  
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	int a,b,c,d,x,y,n;
	while(cin>>a>>b>>c,a){
		x=a*a+b*b;
		if(b*b+c*c<x)x=b*b+c*c;
		if(c*c+a*a<x)x=c*c+a*a;
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>y;
			if(x<y*y*4)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
}

C++: #include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    int x[3],n;
    cin>>x[0]>>x[1]>>x[2]>>n;
    sort(x,x+3);
    x[0] /= 2;
    x[1] /= 2;
    double a = sqrt(x[0] * x[0] + x[1] * x[1]);
    while(n--){
        int r;
        cin>>r;
        if(r<=a)cout<<"NA"<<endl;
        else cout<<"OK"<<endl;
    }


    return 0;
}