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 <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  ){ 
      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>
#define min(a, b) (a > b ? b : a)

int main() {
    int a, b, c;
    while (std::cin >> a >> b >> c && a && b && c) {
        int n;
        std::cin >> n;

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

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

using namespace std;

int main()
{
    int a, b, c, chk;


    while (cin >> a >> b >> c, a || b || c) {
        chk = min(a * a + b * b, min(b * b + c * c, a * a + c * c));

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

            cin >> r;
            if ((2 * r) * (2 * r) >= chk)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main()
{

	int a, b, c, n, r;

	while (cin >> a >> b >> c)
	{
		if ((a == 0) && (b == 0) && (c == 0)) break;

		double ab, bc, ac, taikaku;
		ab = sqrt(pow(a, 2) + pow(b, 2));
		bc = sqrt(pow(b, 2) + pow(c, 2));
		ac = sqrt(pow(a, 2) + pow(c, 2));
		taikaku = ab;
		if (taikaku>bc)
		{
			taikaku = bc;
		}
		else if (taikaku>ac)
		{
			taikaku = ac;
		}

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

	}
	return 0;
}

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

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

  while (1) {
    scanf("%d %d %d", &x, &y, &z);
    if (!x && !y && !z) break;
    scanf("%d", &n);
    if (x>y && x>z) {
      a = y;
      b = z;
    } else if (y>z) {
      a = z;
      b = x;
    } else {
      a = x;
      b = y;
    }
    c = ceil(sqrt((a*a+b*b)*0.25));
    for (int i=0; i<n; i++) {
      scanf("%d", &r);
      if (r < c) {
        printf("NA\n");
      } else {
        printf("OK\n");
      }
    }
  }

  return 0;
}

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

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

int main()
{
  int d[4],n,r;
  while(cin >> d[0] >> d[1] >> d[2] , d[0]){
    cin >> n;
    sort(d, d + 3);
    int ans = d[0] * d[0] + d[1] * d[1];
    while(n--){
      cin >> r;
      cout << (r * r * 4 > ans ? "OK" : "NA") << endl;
    }
  }
}

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

double m[3];
void solve(){

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

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;
		int line = (first*first)+(second*second);
		cin >> n;
		while(n--){
			cin >> r;		

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

	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(ll a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll in1, in2, in3;
	while (true) {
		cin >> in1 >> in2 >> in3;
		if (in1 == 0 && in2 == 0 && in3 == 0) { break; }
		vector<ll>a;
		a.pb(in1);
		a.pb(in2);
		a.pb(in3);

		Sort(a);
		ll n;
		cin >> n;
		double save = sqrt(a[0] * a[0] + a[1] * a[1]) / 2.00;
		rep(i, n) {
			double r;
			cin >> r;
			if (r > save) { cout << "OK" << endl; }
			else { cout << "NA" << endl; }
		}
		return 0;
	}
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	long long int a,s,d,f,g[100000],h,i,j,z,x,c,q[4];
	while(1){
			scanf("%lld %lld %lld",&a,&s,&d);
			if(a==0&&s==0&&d==0)	break;
		scanf("%lld",&f);
		for(i=0;i<f;i++)	scanf("%lld",&g[i]);
		q[0]=a*a+s*s;
		q[1]=a*a+d*d;
		q[2]=s*s+d*d;
		for(i=0;i<f;i++){
			j=(g[i]*2)*(g[i]*2);
			if(j<=q[0]&&j<=q[1]&&j<=q[1])	printf("NA\n");
			else	printf("OK\n");
		}
	}
	return 0;
}

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

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

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

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