import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
//import std.regex;
import std.container;

void main()
{
	while (1) {
		auto x = readln.chomp.split.map!(to!int);
		if (x[0]+x[1]+x[2] == 0) break;
		auto len = new double[](3);
		len[0] = hypot(x[0], x[1]) / 2;
		len[1] = hypot(x[0], x[2]) / 2;
		len[2] = hypot(x[1], x[2]) / 2;
		auto n = readln.chomp.to!int;
		foreach (i; 0..n) {
			auto r = readln.chomp.to!int;
			bool f;
			foreach (e; len) {
				if (e < r) f = 1;
			}
			if (f) writeln("OK");
			else writeln("NA");
		}
	}
}