
import std.stdio, std.algorithm;

void main() {
  for(int w, h, d; readf("%d %d %d\n", &w, &h, &d), w + h + d != 0;) {
    int m = reduce!(max)([w, h, d]);
    int n; readf("%d\n", &n);
    foreach(i; 0..n) {
      int k;
      readf("%d\n", &k);
      writeln(m >= k * 2 ? "NA" : "OK");
    }
  }
}