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<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1e7
int main(){
    ll d,w,h;
    while(cin >> d >> w >> h,d+w+h){
        int n; cin>>n;
        vi v (n+1,0);
        double pi = acos(-1.0);
        rep(i,n){
            cin >>v[i];
            double temp = v[i]*v[i]*pi;
            int r = 2*v[i];
            //cout << "temp : " << temp << "s :" << s << endl;
            if( d<r && w<r && h<r )
                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<double> 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());
		double dis = v[0]*v[0] + v[1]*v[1];
		cout << dis << endl;

		int n;
		cin >> n;

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

			r *= 2;

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

		}
	}
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>

using namespace std;

double d,w,h,r[10000];

int main()
{
    while( 1 )
    {
        scanf( "%lf %lf %lf\n", &d, &w, &h );
        if( d == 0 && w == 0 && h == 0 ) break;
        if( d > w )
        {
            swap( d, w );
        }
        if( w > h )
        {
            swap( w, h );
        }
        if( d > w )
        {
            swap( d, w );
        }
        double mini = sqrt( d * d + w * w ) / 2;
        int n;
        scanf( "%d\n", &n );
        for( int i = 0; i <n; i++ )
        {
            scanf( "%lf\n", &r[i] );
            if( mini < r[i] )
            {
                printf( "OK\n" );
            }
            else
            {
                printf( "NA\n" );
            }
        }      
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int x[3];
        for(int i=0; i<3; ++i)
            cin >> x[i];
        if(x[0] == 0)
            return 0;
        sort(x, x+3);

        int n;
        cin >> n;

        while(--n >= 0){
            int r;
            cin >> r;
            if(4*r*r - x[0]*x[0] - x[1]*x[1] > 0)
                cout << "OK" << endl;
            else
                cout << "NA" << endl;
        }
    }
}

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define PREP(it,array) for(vector<P>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)

#define MP       make_pair
#define PB       push_back
#define ALL(x)   (x).begin(),(x).end()

const int INF = 1<<29;
const double EPS = 1e-9;
double zero(double d){
  return d < EPS ? 0.0 : d;
}

typedef long long LL;
typedef pair<int,int> P;

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(7);

  int a[3];
  while(cin>>a[0]>>a[1]>>a[2],a[0]|a[1]|a[2]){
    sort(a,a+3);
    int m1 = a[0];
    int m2 = a[1];
    double t = sqrt( a[0]*a[0] + a[1]*a[1] );

    int n;
    cin>>n;
    REP(i,n){
      int s;
      cin>>s;
      if( s*2 <= t )
	cout << "NA" << endl;
      else
	cout << "OK" << endl;
    }
  }

  return 0;
}

C++: #include <cstdio>

int d, w, h, n, r;

int main() {
  while (scanf("%d %d %d", &d, &w, &h), d || w || h) {
    scanf("%d", &n);
    
    int line[3];
    line[0] = d*d + w*w;
    line[1] = w*w + h*h;
    line[2] = h*h + d*d;
    for (int i=0; i<n; i++) {
      scanf("%d", &r);
      int r2 = r*r*4;
      
      if (line[0] < r2 || line[1] < r2 || line[2] < r2) {
	printf("OK\n");
      } else {
	printf("NA\n");
      }
    }
  }
}

C++: #include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <map>
#define loop(i,a,b) for(int i=a; i<b; i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()

using namespace std;

typedef vector<int> vi;

string const res[] = { "NA", "OK" };

int main(){
    int a, b, c;
    while (cin >> a >> b >> c && a | b | c){
        vi v{ a, b, c };
        double d = 1e50;
        rep(i, 3)rep(j, 3)if (i != j){
            d = min(d, sqrt(v[i] * v[i] + v[j] * v[j]));
        }
        int n; cin >> n;
        rep(i, n){
            double r; cin >> r;
            r *= 2;
            double const eps = 1e-9;
            cout << res[r - eps > d] << endl;
        }
    }
}

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 ){
      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;

}