#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int x, y, z;
	while(cin >>x >>y >>z){
		if(x == 0 && y == 0 && z == 0) break;
		int n;
		cin >>n;
		for(int i = 0; i < n; i++){
			int door;
			cin >>door;
			if(door >= x || door >= y || door >= z){
				cout <<"OK" <<endl;
			} else{
				cout <<"NA" <<endl;
			}
		}
	}
	return 0;
}