Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

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")

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')

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")

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))

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")

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)

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')

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

Python: def min_diam(A,B,C): # returns a "diameter"
  segments=[A,B,C]
  segments.sort()
  return (segments[0]**2+segments[1]**2)**(1/2)

while True:
  # input one dataset
  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())
  # process
  diam = min_diam(A,B,C)
  # judge & output
  for r in R:
    if diam < 2*r:
      print("OK")
    else:
      print("NA")

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")

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

while True:
  # input one dataset
  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())

  # process
  min_diag = min_diag(A,B,C)

  # judge & output
  for r in R:
    if min_diag < 2*r:
      print("OK")
    else:
      print("NA")

Python: import sys
for a in sys.stdin:
 if' 'in a:
  s=list(map(int,a.split()))
  c=0
  while 1:
   t=s;s=[t.count(e)for e in t]
   if t==s:break
   c+=1
  print(c);print(*s)

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 2*r*r > minrad:
            print('OK')
        else:
            print('NA')

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")

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')

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")

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')

Python: # 長方体の内小さい2辺を元に長方形の外接円を考える
# sqrt(a^2+b^2)/2が長方形の外接円の半径となるため
# r>sqrt(a^2+b^2)/2であれば入口に接さずにチーズを搬入可能
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")

Python: import sys
#from me.io import dup_file_stdin

#@dup_file_stdin
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()

Python: # -*- coding: utf-8 -*-
"""
"""
import sys


def solve(d, w, h, holes):
    result = []
    # ???????????\????????£?????¢???1????????????: ????????????r x 2**0.5
    for r in holes:
        side_max = max(w, h)
        if r*2**0.5 >= side_max:
            result.append('OK')
        else:
            result.append('NA')
    return result


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


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

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")

Python: import sys
i=iter(sys.stdin)
for k,s in zip(i,i):
 if'0'==k:break
 s=list(map(int,s.split()))
 c=0
 while 1:
  t=s;s=[t.count(e)for e in t]
  if t==s:break
  c+=1
 print(c);print(*s)