#include<stdio.h>
#include<math.h>
#include<algorithm>
int main(){int a,b,c,n,r;for(;scanf("%d%d%d",&a,&b,&c),a|b|c;)for(scanf("%d",&n);n--;puts( (2*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?"OK":"NA"));scanf("%d",&r);}