import std.stdio, std.string, std.conv, std.algorithm, std.math;

void main()
{
    while(true)
    {
        auto inp = readln.split.map!(to!int);
        if(!inp[0] && !inp[1] && !inp[2]) break;
        real a = inp[0], b = inp[1], c = inp[2];
        real r = min(a * a + b * b, b * b + c * c, c * c + a * a).sqrt; 
        foreach(_; 0 .. readln.chomp.to!int)
        {
            if(readln.chomp.to!int * 2 > r) "OK".writeln;
            else "NA".writeln;
        }
    }
}