#include <iostream>
using namespace std;

int main(){
	int h,w,d,n,a;
	while(cin >> h >> w >> d,h){
		cin >> n;
		for(int i = 0;i < n;++i){
			cin >> a;
			if(a >= h || a >= w || a >= d){
				cout << "OK" << endl;
			}
			else cout << "NA" << endl;
		}
	}
	return 0;
}