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<cmath>
#include<vector>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){

  vector<int>in(3);
	while(cin>>in[0]>>in[1]>>in[2],in[0]||in[1]||in[2]){
  	sort(in.begin(),in.end());	
	  double h=hypot(in[0],in[1])/2;
	
  	int n;
	  cin>>n;
	  rep(i,n){
		  int ans;
		  cin>>ans;
		  if(h<ans)cout<<"OK"<<endl;
		  else cout<<"NA"<<endl;
		}
	
	}
}

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

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

inline bool inside(double a, double b, int r) {
  return a*a+b*b < (double)(r*r);
}

using namespace std;

int main() {
  loop {
    double a, b, c;
    cin >> a >> b >> c;
    if (!(a || b || c)) return 0;
    a /= 2;
    b /= 2;
    c /= 2;
    int n;
    cin >> n;
    repeat(i, n) {
      int r;
      cin >> r;
      if (inside(a, b, r) || inside(b, c, r) || inside(c, a, r))
        cout << "OK" << endl;
      else
        cout << "NA" << endl;
    }
  }
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
//#define M(a,b) a<b?a:b
int main(){
	int a,b,c,n,r;
	for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2*r>std::min(std::min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

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

//0107
int main(){
	int a, b, c;
	int n, r;
	int first, second;
	list<int> el(0);

	while(cin >> a >> b >> c){
		if(a==0 && b==0 && c==0)break;
		el.push_back(a);
		el.push_back(b);
		el.push_back(c);
		el.sort();
		list<int>::iterator ite = el.begin();
		first = *ite++;
		second = *ite;

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

			//三平方の定理でチーズの対角線を求めて、
			//それが直径より大きいかで判定する
			if( (2*r)*(2*r) > (first*first)+(second*second)){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)

int main()
{
    int a, b, c;
    int n;
    int r;
    while (scanf("%d %d %d", &a, &b, &c))
    {
        if (a == 0 and b == 0 and c == 0)
            return 0;
        scanf("%d", &n);
        int r1;
        r1 = a * a + b * b;
        r1 = min(r1, b * b + c * c);
        r1 = min(r1, c * c + a * a);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &r);
            printf("%s\n", 4 * r * r > r1 ? "OK" : "NA");
        }
    }
    return 0;
}

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

int main(){
  std::vector<int> size[3];
  int x, n, r;
  
  std::cin >> x;
  size.push(x);
  std::cin >> x;
  size.push(x);
  std::cin >> x;
  size.push(x);
  size.sort(size.begin(), size.end());
  
  while(d!=0 && w!=0 && h!=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;
      }
    }
  }
  
  return 0;
}

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