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

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