#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		if (!a && !b && !c)break;
		int d;
		cin >> d;
		if (b > a) {
			for (int e = 0; e < d; e++) {
				int f;
				cin >> f;
				if (f * 2>b)cout << "OK" << endl;
				else cout << "NA" << endl;
			}
		}
		else {
			for (int e = 0; e < d; e++) {
				int f;
				cin >> f;
				if (f * 2>a)cout << "OK" << endl;
				else cout << "NA" << endl;
			}
		}
	}
}