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 <stdio.h>
#include <math.h>
int main(void)
{
  int i;
  double temp;
  double x[3];
  int y, z;
  int n;
  double t;

  while(1){
    for(i=0; i<3; i++)
      scanf("%d", &x[i]);
    if(x[0]==0 && x[1]==0 && x[2]==0)
      break;
      
    if(x[0]>x[1]){
      temp=x[0];
      x[0]=x[1];
      x[1]=x[0];
    }

    if(x[1]>x[2]){
      temp=x[1];
      x[1]=x[2];
      x[2]=x[1];
    }   
    if(x[0]>x[2]){
      temp=x[0];
      x[0]=x[2];
      x[2]=x[0];
    }
  
  t=x[0]*x[0]+x[1]*x[1];
  t=sqrt(t);
  
  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    scanf("%d", &y);
    
    if(2*y>t)
      printf("OK\n");
    else
      printf("NA\n");
    
  }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e4;

int main()
{
	lld d,w,h,n;

	while(1)
	{
		cin >> d >> w >> h;
		if (d==0 && w==0 && h==0)
		{
			break;
		}
		lld di = min(d*d+w*w, w*w+h*h);
		di = min(di,h*h+d*d);

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

			if (4*r*r > di)
			{
				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 = MAX ,nagai2 = MAX ;
  
  string hantei[MAX];
  

  while(1){

    cin >> a >> b >> h ;

    if ( nagai1 > a ) nagai1 = a; 
    if ( nagai1 > b ){
      nagai2 = nagai1 ;
      nagai1 = b;
    }
    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<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;

int main() {
  vector<int> side(3);  // ???, ?¨?, ??????
  int n;                // ??\??£????????°
  int rad;              // ??\??£?????????
  int diagonal;         // ????§?????????????
  string ans[2] = { "NG", "OK" }; // ??????
  while(1) {
    cin >> side[0] >> side[1] >> side[2];
    if (side[0] + side[1] + side[2] == 0) break;
    // ????§????????¨????
    {
      sort(side.begin(), side.end());
      diagonal = sqrt(pow((double)side[0], 2) + pow((double)side[1], 2));
    }
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> rad;
      cout << (rad*2 > diagonal ? "OK" : "NA") << endl;
    }
  }

}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int v, w, h;
    while(cin >> v >> w >> h && v)
    {
        int r = v * v + w * w;
        r = min(r, w*w + h*h);
        r = min(r, h*h + v*v);

        int n, hole; cin >> n;
        REP(n)
        {
            cin >> hole;
            if(r < hole * hole * 4) cout <<"OK" << endl;
            else cout << "NA" << endl;
        }

    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int N, A, B, C, R, Q;

	while (true)
	{
		cin >> A >> B >> C;

		if (A == 0 && B == 0 && C == 0)
		{
			break;
		}

		if (A > B) { swap(A, B); }
		if (A > C) { swap(A, C); }
		if (B > C) { swap(B, C); }

		Q = A * A + B * B;

		cin >> N;

		for (int i = 0; i < N; i++)
		{
			cin >> R;

			if (R * R * 4 > Q)
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

#define sqr(x) ((x)*(x))

int main() {
	int a, b, c;
	
	while(cin >> a >> b >> c, a || b || c) {
		int n;
		double m;
		cin >> n;

		m = min(sqrt(sqr(a)+sqr(b)),min(sqrt(sqr(b)+sqr(c)),sqrt(sqrt(c)+sqr(a))));

		for(int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			if(m < tmp * 2)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}

	return 0;
}

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

int diagonal( int a, int b, int c ){
	if( a > c ) swap( a, c );
	if( b > c ) swap( b, c );
	return a*a + b*b;
}

int main()
{
	int a, b, c;
	while( cin >> a >> b >> c && !( a == 0 && b == 0 && c == 0 ) ){
		int dia_square = diagonal( a, b, c );

		int num;
		cin >> num;
		for( int i = 0; i < num; ++i ){
			int radius;
			cin >> radius;
			if( dia_square < radius * radius * 4 ){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

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

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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#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())

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main() {
  double c[3], n;

  while(cin >> c[0] >> c[1] >> c[2], c[0]+c[1]+c[2]) {
    sort(c, c+2);
    double size = sqrt(c[0]*c[0] + c[1]*c[1]);
    cin >> n;
    REP(i, n) {
      double r;
      cin >> r;
      if(2*r > size) cout << "OK" << endl;
      else cout << "NA" << endl;
    }
  }
}