import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val p = (x: Int) => math.pow(x, 2)
    val sc = new Scanner(System.in)

    var xyz = List(sc.nextInt, sc.nextInt, sc.nextInt).sorted

    while (xyz != List(0, 0, 0)) {
      val List(a, b, c) = xyz
      val enterable = math.sqrt(p(a) + p(b)) / 2

      for (i <- 0 until sc.nextInt) {
        val n = sc.nextInt
        println(if (n > enterable) "OK" else "NA")
      }

      xyz = List(sc.nextInt, sc.nextInt, sc.nextInt).sorted
    }

    sc.close()
  }
}