0107 - Carry a Cheese

#include <cmath>
#include <iostream>
using namespace std;

void Slove(double a, double b, double c)	{
	int n;
	double r;

	cin >> n;
	for (int i=0; i<n; ++i)	{
		cin >> r;
		if ( pow(a/2.0,2)+pow(b/2.0,2)<pow(r,2) || pow(b/2.0,2)+pow(c/2.0,2)<pow(r,2) || pow(c/2.0,2)+pow(a/2.0,2)<pow(r,2) )
			cout << "OK" << endl;
		else	cout << "NA" << endl;
	}
}

int main(void)	{
	double a, b, c;

	while (cin >> a >> b >> c && (a || b || c) )
		Slove(a,b,c);
	return 0;
}

3辺の中から2辺を選んで円の中を通れるか試すだけ。