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

void main(){

    while(true){
	auto s = readln().split().to!(double[]);
	if(s[0] == 0 && s[1] == 0 && s[2] == 0) break;
	int r = to!int( sqrt( s[1]*s[1] + s[2]*s[2] )/2.0 );
	int n = readln().chomp().to!int;
	for(int i=0;i<n;i++){
	    if( r < readln().chomp().to!int) writeln("OK");
	    else writeln("NA");
	}
    }

}