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

int main()
{
	while(true)
	{
		string[] s = readln.chomp.split(" ");
		int a[3];
		a[0] = s[0].to!int;
		a[1] = s[1].to!int;
		a[2] = s[2].to!int;

		if(a[0] == 0 && a[1] == 0 && a[2] == 0)
		{
			break;
		}

		a.sort;

		int d = a[0]*a[0] + a[1]*a[1];

		int n = readln.chomp.to!int;
		while(n--)
		{
			int r = readln.chomp.to!int;
			if(d < (r*2)*(r*2))
			{
				"OK".writeln;
			}
			else
			{
				"NA".writeln;
			}
		}
	}
	return 0;
}