#include <iostream>
#include <vector>

using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int dx[12] = {-2,-2,-2,-1,0,1,2,2,2,1,0,-1};
int dy[12] = {-1,0,1,2,2,2,1,0,-1,-2,-2,-2};
int main() {
	int sx, sy, n;
	while(cin >> sx >> sy && (sx || sy)) {
		cin >> n;
		int x[10] = {}, y[10] = {};
		rep(i,n) {
			cin >> x[i] >> y[i];
		}
		vector<int> qx,qy;
		qx.push_back(sx), qy.push_back(sy);
		rep(k,n) {
			int sz = qx.size();
			cout << sz << endl;
			rep2(i,-1,2) {
				if(x[k]+i < 0 || 9 < x[k]+i) continue;
				rep2(j,-1,2) {
					if(y[k]+j < 0 || 9 < y[k]+j) continue;
					rep(l,sz) {
						bool f = 0;
						rep(m,12) {
							if(x[k]+i+dx[m] == qx[l] && y[k]+j+dy[m] == qy[l]) {
								qx.push_back(x[k]+i);
								qy.push_back(y[k]+j);
								f = 1;
								break;
							}
						}
						if(f) break;
					}
				}
			}
			rep(i,sz) {
				qx.erase(qx.begin());
				qy.erase(qy.begin());
			}
		}
		if(qx.empty()) cout << "NA" << endl;
		else cout << "OK" << endl;
	}
	return 0;
}