Problem:
Carry a Cheese Jerry is a little mouse. He is trying to survive from the cat Tom. Jerry is carrying a parallelepiped-like piece of cheese of size A × B × C . It is necessary to trail this cheese to the Jerry's house. There are several entrances in the Jerry's house. Each entrance is a rounded hole having its own radius R . Could you help Jerry to find suitable holes to be survive? Your task is to create a program which estimates whether Jerry can trail the cheese via each hole.
The program should print " OK " if Jerry can trail the cheese via the corresponding hole (without touching it). Otherwise the program should print " NA ". You may assume that the number of holes is less than 10000. Input The input is a sequence of datasets. The end of input is indicated by a line containing three zeros. Each dataset is formatted as follows:  A B C  n  R 1  R 2 .
 . R n   n indicates the number of holes (entrances) and R i indicates the radius of i -th hole. Output For each datasets, the output should have n lines. Each line points the result of estimation of the corresponding hole. Sample Input 10 6 8
5
4
8
6
2
5
0 0 0 Output for the Sample Input NA
OK
OK
NA
NA

Solution (Python):
while True:
    size = map(int,raw_input().split())
    if size[0] == size[1] == size[2] == 0:
        break
    size = sorted(size)
    rmin2 = size[0]**2 + size[1]**2
    
    n = input()
    for i in range(n):
        R2 = 4 * input()**2
        if rmin2 < R2:
            print 'OK'
        else:
            print 'NA'

Solution (Python):
while True:
    size = map(int,raw_input().split())
    if size[0] == 0:
        break
    size = sorted(size)
    rmin2 = size[0]**2 + size[1]**2
    
    n = input()
    for i in range(n):
        R2 = (input()**2)*4
        if rmin2 < R2:
            print 'OK'
        else:
            print 'NA'

Solution (Python):
while 1:
  a,b,c=sorted(map(int,raw_input().split()))
  if a==b==c==0: break
  D=(a*a+b*b)**.5
  for _ in [0]*input(): print ["NA","OK"][2*input()>D]

Solution (Python):
while 1:
  a,b,c=sorted(map(int,raw_input().split()))
  if a==b==c==0: break
  D=a*a+b*b
  n=input()
  for _ in [0]*n:
    r=input()
    print ["NA","OK"][4*r**2>D]

Solution (Python):
def hantei(A,B,C,R=0):
    p,q = sorted([A,B,C])[:2]
    if p**2 + q**2 < 4 * R**2:
        print 'OK'
    else:
        print 'NA'

while True:
    try:
        A,B,C = map(int,raw_input().split())
        if (A,B,C) == (0,0,0):
            break
    except EOFError:
        break

    for k in range(int(raw_input())):
        hantei(A,B,C,int(raw_input()))

Solution (Python):
while(1):
    size=sorted([int(x) for x in raw_input().split()])
    if size[0]==0:
        break
    else:
        cr=size[0]**2+size[1]**2
        n=int(raw_input())
        for i in range(n):
            r=int(raw_input())
            if 4*r**2>cr:
                print 'OK'
            else:
                print 'NA'

Solution (Python):
while True:
    solid = sorted(map(int, raw_input().split()))
    if solid.count(0) == 3: break
    n = input()
    s = (solid[0]**2+solid[1]**2)/4
    for i in range(n):
        r = input()
        if r*r > s:
            print 'OK'
        else:
            print 'NA'

Solution (Python):
while True:
    A, B, C = map(int, raw_input().split())
    if A == 0: break;   
    n = input()
    r = min([((A**2)+(B**2))**0.5, ((A**2)+(C**2))**0.5, ((B**2)+(C**2))**0.5])
    for i in range(n):
        if (input()*2 > r): print "OK"
        else: print "NA"

Solution (Python):
import math

def Tom_and_Jerry():
    for i in range(int(raw_input())):
        r = int(raw_input())
        if r > t:
            print 'OK'
        else:
            print 'NA'

while True:
    h, w, d = map(int, raw_input().split(' '))
    if h == 0: break
    
    a = math.sqrt(h**2 + w**2) / 2.0
    b = math.sqrt(h**2 + d**2) / 2.0
    c = math.sqrt(w**2 + d**2) / 2.0
    if a < b and a < c:
        t = a
    elif b < a and b < c:
        t = b
    elif c < a and c < b:
        t = c
    
    Tom_and_Jerry()

Solution (Python):
import math

def doc_string():
	"""
	I can fly.
	"""

while True:
	tz = map(int,raw_input().split())
	if tz == [0,0,0]:
		break

	til = math.hypot(*sorted(tz)[:2]) / 2
	for i in xrange(int(raw_input())):
		gate = int(raw_input())
		if gate > til:
			print "OK"
		else:
			print "NA"

Solution (Python):
while True:
  l = [int(i) for i in input().split()]
  if l == [0,0,0]:
    break
  l.sort()
  r = (l[0]**2+l[1]**2)**(1/2)/2
  n = int(input())
  for i in range(n):
    r1 = int(input())
    if r < r1:
      print('OK')
    else:
      print('NA')

Solution (Python):
def sol():
    tmp=min([x**2+y**2,x**2+z**2,y**2+z**2])
    n=int(raw_input())
    for i in range(n):
        r=int(raw_input())
        print 'OK' if (r**2)*4>tmp else 'NA'

while 1:
    x,y,z=map(int,raw_input().split())
    if min(x,y,z)==0:
        break
    else:
        sol()

Solution (Python):
import math

while True:
    d, w, h = [int(x) for x in input().split()]
    if d == w == h == 0:
        break
    dw = math.sqrt(d * d + w * w)
    dh = math.sqrt(d * d + h * h)
    wh = math.sqrt(w * w + h * h)
    min_ = min(dw, dh, wh)
    n = int(input())
    for i in range(n):
        r = int(input()) * 2
        if r > min_:
            print('OK')
        else:
            print('NA')

Solution (Python):
while True:
    try:
        d, w, h = list(map(int, input().split()))
        if d == w == h == 0:
            break
        n = int(input())
        r = []
        for i in range(n):
            r = int(input())
            if r ** 2 > (d ** 2 + w ** 2) / 4 \
                or r ** 2 > (d ** 2 + h ** 2) / 4 \
                or r ** 2 > (h ** 2 + w ** 2) / 4 :
                print("OK")
            else:
                print("NA")
    except EOFError:
        break

Solution (Python):
import math

while True:
	l1, l2, l3 = sorted(list(int(i) for i in input().split()))
	if l1 == l2 == l3 == 0:
		break
	n = int(input())
	R = math.sqrt(l1 ** 2 + l2 ** 2) / 2
	for i in range(n):
		r = int(input())
		if r > R:
			print('OK')
		else:
			print('NA')

Solution (Python):
while True:
    Size_lis = list(map(int,input().split()))
    if Size_lis == [0,0,0]:
        break
    n = int(input())
    Size_lis.remove(max(Size_lis))
    m_r = (Size_lis[0] / 2) ** 2 + (Size_lis[1] / 2) ** 2

    for i in range(n):
        r = int(input())
        if m_r >= r ** 2:
            print("NA")
        else:
            print("OK")

Solution (Python):
while 1:
    a,b,_=sorted(map(int,input().split()))
    if a==0:break
    c=(a**2+b**2)**0.5
    for _ in range(int(input())):print('OK' if c<int(input())*2 else 'NA')

Solution (Python):
while 1:
    a,b,_=sorted(map(int,input().split()))
    if a==0:break
    c=(a**2+b**2)**0.5//2
    for _ in range(int(input())):print('OK' if c<int(input()) else 'NA')

Solution (Python):
def min_diam(A,B,C): 
  segments=[A,B,C]
  segments.sort()
  return (segments[0]**2+segments[1]**2)**(1/2)

while True:
  
  A,B,C = tuple(map(float,input().split()))
  if (A,B,C) == (0,0,0):
    break
  n = int(input())
  R = [None]*n
  for i in range(n):
    R[i] = float(input())
  
  diam = min_diam(A,B,C)
  
  for r in R:
    if diam < 2*r:
      print("OK")
    else:
      print("NA")

Solution (Python):


import sys
import os
import math

for s in sys.stdin:
    d, w, h = map(int, s.split())
    if d == w == h == 0:
        break

    lst = [d, w, h]
    lst.sort()
    diameter = math.sqrt(lst[0] ** 2 + lst[1] ** 2)

    n = int(input())

    for i in range(n):
        r = int(input())
        if 2 * r > diameter:
            print('OK')
        else:
            print('NA')

Solution (Python):

 
import sys
import os
import math
 
for s in sys.stdin:
    d, w, h = map(int, s.split())
    if d == w == h == 0:
        break
 
    lst = [d, w, h]
    lst.sort()
    diameter = math.sqrt(lst[0] ** 2 + lst[1] ** 2)
 
    n = int(input())
 
    for i in range(n):
        r = int(input())
        if 2 * r > diameter:
            print('OK')
        else:
            print('NA')

Solution (Python):
while True:
    d, w, h = map(int, input().split())
    if d == 0:
        break
    n = int(input())
    a, b = sorted([d, w, h])[:2]
    t = pow(pow(a, 2) + pow(b, 2), 0.5) // 2
    for _ in range(n):
        print("OK" if int(input()) > t else "NA")

Solution (Python):

"""
"""
import sys


def solve(d, w, h, holes):
    result = []
    diagonal_len = (w**2 + h**2)**0.5
    for r in holes:
        if r*2 > diagonal_len:
            result.append('OK')
        else:
            result.append('NA')
    
    
    
    
    
    
    
    return result


def main(args):
    while True:
        
        
        d, w, h = [int(x) for x in input().strip().split(' ')]
        if d == 0 and w == 0 and h == 0:
            break
        num = int(input())
        holes = [int(input().strip()) for _ in range(num)]
        result = solve(d, w, h, holes)
        for r in result:
            print(r)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


while True:
    a, b, c = sorted([int(_) for _ in input().split()])
    R = .5 * math.sqrt(a**2 + b**2)
    if a == b == c == 0:
        break
    N = int(input())
    for _ in range(N):
        r = int(input())
        print("OK" if r > R else "NA")

Solution (Python):
while True:
    d, w, h = [int(x) for x in input().split()]
    minrad = min(d*d+w*w,w*w+h*h,h*h+d*d)
    if minrad == 0:
        break
    n = int(input())
    for i in range(n):
        r = int(input())
        if 4*r*r > minrad:
            print('OK')
        else:
            print('NA')

Solution (Python):
import math
while True:
	d,w,h = map(int,input().split())
	if d == 0:
		break
	n = int(input())
	dist = [math.sqrt(d**2+w**2), math.sqrt(d**2+h**2), math.sqrt(w**2+h**2)]
	leng = min(dist)
	for i in range(n):
		if 2*int(input())-leng > 0:
			print('OK')
		else:
			print('NA')

Solution (Python):
import sys



def solve():
    while True:
        l = list(map(int,sys.stdin.readline().split(' ')))
        if l[0] == 0: break
        l.sort();
        n = int(sys.stdin.readline())
        for i in range(n):
            r = int(sys.stdin.readline())
            if r*r*4>l[0]*l[0]+l[1]*l[1]:
                print("OK")
            else:
                print("NA")
solve()

Solution (Python):
import math

output = []

while True:
    depth, width, height = [int(item) for item in input().split(" ")]

    if depth == 0 and width == 0 and height == 0:
        break

    cheeseRadius = math.sqrt((width / 2)**2 + (height / 2)**2)

    inputCount = int(input())

    for lp in range(inputCount):
        entranceRadius = int(input())

        if cheeseRadius < entranceRadius:
            output.append("OK")
        else:
            output.append("NA")

print("\n".join(output))

Solution (Python):
while 1:
 a,b,_=sorted(map(int,input().split()))
 if a==0:break
 for _ in[0]*int(input()):
  r=int(input())
  print("OK"if r*r*4>a*a+b*b else"NA")

Solution (Python):
while 1:
 a,b,_=sorted(map(int,input().split()))
 if a==0:break
 for _ in[0]*int(input()):print("OK"if (int(input())*2)**2>a*a+b*b else"NA")

Solution (Python):
while 1:
 a,b,_=sorted(map(int,input().split()))
 if a==0:break
 for _ in[0]*int(input()):print("OK"if (int(input())*2)**2>a*a+b*b else"NA")

Solution (Python):
while 1:
 a,b,_=sorted(map(int,input().split()))
 if a==0:break
 for _ in[0]*int(input()):print("OK"if(int(input())*2)**2>a*a+b*b else"NA")

Solution (Python):
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

while True:
    d = [int(i) for i in input().split()]
    if d[0] == 0 and d[1] == 0 and d[2] == 0:
        break

    d.sort()
    cheese = d[0] * d[0] + d[1] * d[1]

    N = int(input())
    for l in range(N):
        R = int(input())*2
        if cheese < R*R:
            print("OK")
        else:
            print("NA")

Solution (Python):
while True:
  lst = list(map(int, input().split()))
  if not lst[0]:
    break
  lst.sort()
  rad = (lst[0] ** 2 + lst[1] ** 2 ) ** (1 / 2) / 2  
  n = int(input())
  for _ in range(n):
    print("OK" if int(input()) > rad else "NA")

Solution (Python):
import itertools

def ch(l,r):
    t=itertools.combinations(l,2)
    for i in t:
        if i[0]**2+i[1]**2<4*r**2:
            return True
    return False

while 1:
    l=list(map(int,input().split()))
    if l[0]==0 and l[1]==0 and l[2]==0:break
    o=[ch(l,int(input())) for i in range(int(input()))] 
    [print("OK") if i else print("NA") for i in o]

Solution (Python):



while True:
	d, w, h = list(map(int, input().split()))
	if d == 0 and w == 0 and h == 0: break
	vmin = min(d*d+w*w, d*d+h*h, w*w+h*h)

	for _ in range(int(input())):
		r = int(input())
		print('OK' if (2*r)**2 > vmin else 'NA')

Solution (Python):
import math

results = []
while True:
    line = raw_input()
    if line == '0 0 0':
        for r in results:
            print r
        break
    else:
        t = [int(n) for n in line.split()]
        t.sort()
        size = math.sqrt(t[0] * t[0] + t[1] * t[1])
        entry = input()
        for i in range(entry):
            if float(2 * input()) > size:
                results.append('OK')
            else:
                results.append('NA')

Solution (Python):
import math

results = []
while True:
    line = raw_input()
    if line == '0 0 0':
        for r in results:
            print r
        break
    else:
        t = [int(n) for n in line.split()]
        t.sort()
        size = math.sqrt(t[0] * t[0] + t[1] * t[1])
        entry = input()
        for i in range(entry):
            if float(2 * input()) > size:
                results.append('OK')
            else:
                results.append('NA')

Solution (Python):
from math import sqrt

while True:
    a, b, c = map(int, raw_input().split())
    if a == 0 and b == 0 and c == 0:
        break

    d1, d2, d3 = sqrt(a**2 + b**2), sqrt(b**2 + c**2), sqrt(c**2 + a**2)

    for i in range(int(raw_input())):
        r = int(raw_input())
        if d1 < r * 2 or d2 < r * 2 or d3 < r * 2:
            print "OK"
        else:
            print "NA"

Solution (Python):
while True:
    le=map(float,raw_input().split())
    if le==[0,0,0]:
        break
    mdl=min([(le[i-1]**2+le[i]**2)**0.5 for i in xrange(3)])
    for u in xrange(input()):
        if input()*2>mdl:
            print "OK"
        else:
            print "NA"

Solution (Python):
import math
while 1:
    es = map(int, raw_input().split())
    if es == [0, 0, 0]: break
    r = math.hypot(*sorted(es)[:2]) / 2
    for i in range(int(raw_input())):
        print 'OK' if int(raw_input()) > r else 'NA'

Solution (Python):
import math
while True:
    l,w,h=map(int,raw_input().split())
    if l==w==h==0:
        break
    n=input()
    for i in range(n):
        r=input()
        leng=math.sqrt(pow(w,2)+pow(h,2))/2
        if r>leng:
            print "OK"
        else:
            print "NA"

Solution (Python):

import sys
import math


def solv(l, w, h, ent):
    cheese = [l, w, h]
    cheese.pop(cheese.index(max(cheese)))
    diagonal = math.sqrt(cheese[0] ** 2 + cheese[1] ** 2)
    ent_size = map(lambda x: x * 2, ent)
    for size in ent_size:
        if diagonal < size:
            print 'OK'
        else:
            print 'NA'


while True:
    l, w, h = tuple(map(int, sys.stdin.readline().split(' ')))
    if (l, w, h) == (0, 0, 0):
        exit()
    n = int(sys.stdin.readline())
    ent = []
    for i in range(n):
        ent.append(int(sys.stdin.readline()))
    solv(l, w, h, ent)

Solution (Python):
from math import sqrt

while True:
    inp = raw_input()
    if inp == "0 0 0": break
    cs = map(int,inp.split())
    cs.sort()
    c = sqrt(cs[0]**2 + cs[1]**2)/2

    n=int(raw_input())

    for gomi in xrange(n):
        r = int(raw_input())
        if c<r: print "OK"
        else: print "NA"

Solution (Python):

from __future__ import division, print_function
from sys import stdin, exit
from math import hypot


def main(readline=stdin.readline):
    answer = ('NA', 'OK')

    while 1:
        height, width, depth = (float(s) for s in readline().split())
        if not height:
            exit()

        hw = hypot(height, width)
        wd = hypot(width, depth)
        dh = hypot(depth, height)

        for _ in range(int(readline())):
            size = float(int(readline()) * 2)
            print(answer[size > hw or size > wd or size > dh])


if __name__ == '__main__':
    main()

Solution (Python):
while 1:
    s=map(int, raw_input().split())
    s.sort()
    if s==[0,0,0]: break
    n = input()
    cr = float(s[0]**2+s[1]**2)/4.0
    for i in xrange(n):
        r = input()
        print "OK" if cr<r**2 else "NA"

Solution (Python):
while 1:
    s=map(int, raw_input().split())
    s.sort()
    if s==[0,0,0]: break
    n = input()
    cr = s[0]**2+s[1]**2
    for i in xrange(n):
        r = input()
        print "OK" if cr<4*r**2 else "NA"

Solution (Python):
import sys
import math
 
 
def solv(l, w, h, ent):
    cheese = [l, w, h]
    cheese.pop(cheese.index(max(cheese)))
    diagonal = math.sqrt(cheese[0] ** 2 + cheese[1] ** 2)
    ent_size = map(lambda x: x * 2, ent)
    for size in ent_size:
        if diagonal < size:
            print 'OK'
        else:
            print 'NA'
 
 
while True:
    l, w, h = tuple(map(int, sys.stdin.readline().split(' ')))
    if (l, w, h) == (0, 0, 0):
        exit()
    n = int(sys.stdin.readline())
    ent = []
    for i in range(n):
        ent.append(int(sys.stdin.readline()))
    solv(l, w, h, ent)

Solution (Python):
import math
while True:
    w,l,h = map(int, raw_input().split())
    if w == 0:
        break
    d = [math.sqrt(w**2+l**2), math.sqrt(l**2+h**2), math.sqrt(h**2+w**2)]
    m = min(d)
    n = int(raw_input())
    for i in range(n):
        r = int(raw_input())
        if 2*r > m:
            print "OK"
        else:
            print "NA"

Solution (Python):
while True:
	size = map(int, raw_input().split())
	if sum(size) == 0: break
	size.remove(max(size))
	m = (size[0]**2 + size[1]**2) ** 0.5
	for i in range(input()):
		n = input()
		print "OK" if m < n * 2 else "NA"

Solution (Python):



while 1:
    dwh = list(map(int,input().split()))
    if dwh[0]==dwh[1]==dwh[2]==0:
        break
    dwh.sort()
    cir = ((dwh[0]**2 + dwh[1]**2)**(1/2))/2
    n = int(input())
    for i in range(n):
        print("OK" if int(input()) > cir else "NA")

Solution (Python):
import math
while True :
    d, w, h = map(int, input().split())
    if d == 0 and w == 0 and h == 0 :
        break
    
    length = [d, w, h]
    len_1 = sorted([d, w, h])[0]
    len_2 = sorted([d, w, h])[1]
    max_d = math.sqrt(len_1**2 + len_2**2)
    
    n = int(input())
    for i in range(n) :
        r = int(input())
        if 2 * r > max_d :
            print("OK")
        else :
            print("NA")

Solution (Python):
while True:
    d, w, h = (int(x) for x in input().split())
    if d == 0: break
    q = int(input())
    vmin = min(d * d + w * w, d * d + h * h, w * w + h * h)
    
    for i in range(0,q):
    	r = int(input())
    	ans = 'NA'
    	if (2 * r) ** 2 > vmin:
    	    ans = 'OK'
    	print(ans)

Solution (Python):
while True:
  d, w,h =list(map(int, input().split()))
  if d ==0 and w==0 and h==0:
    break
  m = min(d*d+w*w, d*d+h*h, w*w+h*h)
  
  for i in range(int(input())):
    r = int(input())
    if (2*r)**2 >m:
      print("OK")
    else:
      print("NA")

Solution (Python):






import sys
import math


class mymath:
    
    pi = 3.14159265358979323846264338

    
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    def pnum_check(self, n):
        if (n==1):
            return False
        elif (n==2):
            return True
        else:
            for x in range(2,n):
                if(n % x==0):
                    return False
            return True

    
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()


class output:
    
    def list(self, l):
        l = list(l)
        
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()






















def printA(A):
    N = len(A)
    for i, n in enumerate(A):
        print(n, end='')
        if i != N-1:
            print(' ', end='')
    print()










def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def dist(A, B):
    d = 0
    for i in range(len(A)):
        d += (A[i]-B[i])**2            
    d = d**(1/2)
    return d

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            
            
        except EOFError:
            break
    return N

while True:
    D, W, H = [int(x) for x in input().split()]
    if D==0 and W==0 and H==0:
        break
    N = int(input())

    for i in range(N):
        r = int(input())
        r1 = (D*D+W*W)**(1/2)/2
        r2 = (W*W+H*H)**(1/2)/2
        r3 = (H*H+D*D)**(1/2)/2
        rm = min([r1,r2,r3])
        if r > rm:
            print('OK')
        else:
            print('NA')

Solution (Python):
while True:
    a=sorted(list(map(int,input().split())))
    if sum(a)==0:
        break
    s=min(a[0]**2+a[1]**2,a[1]**2+a[2]**2,a[0]**2+a[2]**2)
    n=int(input())
    for i in range(n):
        r=int(input())
        print("OK" if (r*2)**2>s else "NA")

Solution (Python):
import math

if __name__ == '__main__':
    
    while True:
        d,w,h = map(int,input().split())
        if d == 0 and w == 0 and h == 0:
            break
    
        a1 = math.sqrt(d*d + h*h)
        a2 = math.sqrt(d*d + w*w)
        a3 = math.sqrt(h*h + w*w)
        n = int(input())

        for _ in range(n):
            c = int(input())
            if c*2 <= a1 and c*2 <= a2 and c*2 <= a3:
                print("NA")
            else:
                print("OK")

Solution (Python):
while 1:
    cheese=list(map(int,input().split()))
    if cheese[0]==0:break
    n=int(input())
    cheese=sorted(cheese)
    for i in range(n):
        radius = int(input())
        if radius*2>(cheese[0]**2+cheese[1]**2)**0.5:print("OK")
        else:print("NA")

Solution (Python):
while 1:
    try:
        dwh=list(map(int,input().split()))
        if dwh[0]==dwh[1]==dwh[2]==0:break
        dwh.sort()
        std=(dwh[0]**2+dwh[1]**2)**0.5/2
        n=int(input())
        for i in range(n):
            r=int(input())
            if std<r:print("OK")
            else:print("NA")
    except:break

Solution (Python):
import math

while 1:
    d, w, h = map(int, input().split())
    if d == 0:
        break

    datas = []
    n = int(input())
    for _ in range(n):
        r = int(input())
        datas.append(r)

    cheese = [d, w, h]
    cheese.sort()
    a = cheese[0]
    b = cheese[1]
    r = math.sqrt(a**2 + b**2) / 2

    for data in datas:
        if r >= data:
            print("NA")
        else:
            print("OK")

Solution (Python):
while True:
    d, w, h = map(int, input().split())
    if d == 0:
        break
    d = min(d**2 + w**2, w**2 + h**2, h**2 + d**2)
    n = int(input())
    for i in range(n):
        d_i = (int(input())*2)**2
        if d_i > d:
            print("OK")
        else:
            print("NA")

Solution (Python):
while True:
    d, w, h = sorted(map(int, input().split()))
    if d == w == h == 0:
        break
    dw = (d**2 + w**2)
    n = int(input())
    for i in range(n):
        y = int(input())
        if (2*y)**2 > dw:
            print("OK")
        else:
            print("NA")

Solution (Python):
while True:
    ch = list(map(int,input().split()))
    if (0 in ch):
        break
    ch.sort()
    n = int(input())
    a = ch[0]
    b = ch[1]
    d = a**2 + b**2
    for i in range(n):
        r = int(input())
        R = 2*r
        if (R**2 > d):
            print('OK')
        else:
            print('NA')

Solution (Python):
t = []
temp = 0
while True:
        d,w,h = [int(s) for s in input().split(' ')]
        if d < w:
            temp = d
        else:
            temp = w
        if d == 0 and w == 0 and h == 0:
            break
        else:
            n = int(input())
            for i in range(n):
                t.append(i)
                t[i] = int(input())
                if (temp/2) ** 2 + (h/2) ** 2 < t[i] ** 2:
                    print("OK")
                else:
                    print("NA")

Solution (Python):
while(True):
    d,w,h = map(int, input().split())
    if d == 0 and w == 0 and h == 0:
        break
    l = min(d*d+w*w,w*w+h*h,h*h+d*d)
    n = int(input())
    for i in range(n):
        r = int(input())
        if 4*r*r > l:
            print("OK")
        else:
            print("NA")