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

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