import scala.io.StdIn.{readLine,readInt}

object Main {
  def main(args:Array[String]) = {
    var dwh = "0 0 0"
    while({dwh=readLine.trim;dwh}!="0 0 0") {
      val s = dwh.split(" ").map(_.toInt).sorted
      val n = readInt
      for(i<-1 to n) {
        val r = readInt
        if(s(0)*s(0)+s(1)*s(1) < 4*r*r) println("OK")
        else println("NA")
      }
    }
  }
}