Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

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

using namespace std;

int main(){

  int d, w, h;
  int n;
  int i;
  int tmp;
  int tmp_1, tmp_2;

  while(1){
    cin >> d >> w >> h;

    if(d==0 && w==0 & h==0)
      break;
    
    cin >> n;

    int r[n];

    if(d<=w && d<=h){
      tmp_1=d*d;
      if(w<=h){
	tmp_2=w*w;
      } else {
	tmp_2=h*h;
      }
    } else {
      tmp_1=w*w;
      tmp_2=h*h;
    }
       
    tmp=tmp_1+tmp_2;
    tmp=sqrt(tmp);
    tmp/=2;

    for(i=0;i<n;i++){
      cin >> r[i];
    }

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

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

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

using namespace std;

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

		sort(a.begin(),a.end());
		int d = a[0]*a[0] + a[1]*a[1];

		int n;
		cin >> n;
		rep(i,n)
		{
			int r;
			cin >> r;

			if(d < (r*2)*(r*2))
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#define MAX 10000
using namespace std;



int main(void){

  
  int  a ,b, h , n , hankei[MAX] , r[MAX] , nagai1 = 0 ,nagai2 = 0 ;
  
  string hantei[MAX];
  

  while(1){

    cin >> a >> b >> h ;

    if ( nagai1 < a ) nagai1 = a; 
    if( nagai1 < b ){
      nagai1 = b; 
      nagai2 = a;
    }
    else nagai2 = b;

      if( nagai1 < h ){ 
      nagai2 = nagai1;
      nagai1 = h;
    }
      else if( nagai2 < h) nagai2 = h ;

 

    if ( a == 0 && b == 0 && h ==0) break;


    cin >> n;


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


    
      cin >> r[i] ;


      // テδづつセテδεつイテδづつキテδεつッテδ暗つステδεつδεつェテδづつ、テδ偲つキテδ療つサテδづつサ

      if ( nagai1 * nagai1 + nagai2 * nagai2  < 4 * r[i] * r[i]  ) hantei[i] = "OK";
      

 


      else hantei[i] = "NA";



      

      //

      cout << hantei[i] << endl ;

    }


      

  }


  return 0;

}

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

int main(){
  int stas[3];
  while(cin >> stas[0] >> stas[1] >> stas[2],stas[0]){
    sort(stas,stas+3);
    int n,r,tmp = stas[0]*stas[0]+stas[1]*stas[1];
    cin >> n;
    for(int i=0;i<n;++i){
      cin >> r;
      if(r*r*4>tmp)cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
}

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

int main(){
    int a,b,c,n,r;

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

    return 0;
}

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

int x[3];
void solve() {
    int n;
    cin >> n;
    int rs[n];
    for (int i = 0; i < n; i++) {
        cin >> rs[i];
    }

    sort(x, x+3);
    int diag_pow_2 = x[0] * x[0] + x[1] * x[1];

    for (int i = 0; i < n; i++) {
        if ( (rs[i] * 2) * (rs[i] * 2) > diag_pow_2) 
            cout << "OK" << endl;
        else 
            cout << "NA" << endl;
    }
}

int main() {
    while (cin >> x[0] >> x[1] >> x[2]) {
        if (x[0] == 0) break;
        solve();
    }
    return 0;
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	double x, y, z;
	while (cin >> x >> y >> z&&(x||y||z)) {
		double v = min(max(x, y), min(max(x, z), max(y, z)));
		int n;
		cin >> n;
		for (int i = 0; i < n; i++)
		{
			double r;
			cin >> r;
			if (fabs(v - r*sqrt(2.0))<=EPS||v<r*sqrt(2.0))
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
}

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

int main(){
	int x,y,z;
	while(1){
		cin>>x>>y>>z;
		if(x==0 && y==0 &&z==0)return 0;
		int dia[3];
		dia[0]=hypot(x,y)/2;
		dia[1]=hypot(y,z)/2;
		dia[2]=hypot(z,x)/2;
		int n;
		cin>>n;
		for(int i=0;i<n;i++){
			int r;
			cin>>r;
			if(r>dia[0] || r>dia[1] || r>dia[2]){
				cout<<"OK"<<endl;
			}else{
				cout<<"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[0]*a[0]+a[1]*a[1];
	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;
}