import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;

bool next(bool[][] m, int x, int y){
	auto s = new bool[][](10+4, 10+4);
	foreach(i; -1..2){
		foreach(j; -1..2){
			s[x+i][y+j] = true;
		}
	}
	foreach(i; 0..10+4){
		s[i][0] = false;
		s[i][1] = false;
		s[i][12] = false;
		s[i][13] = false;
		s[0][i] = false;
		s[1][i] = false;
		s[12][i] = false;
		s[13][i] = false;
	}
	auto t = new bool[][](14,14);
	foreach(i; 2..12) {
		foreach(j; 2..12) {
			if(m[i][j]){
				t[i+2][j-1] = true;
				t[i+2][j] = true;
				t[i+2][j+1] = true;
				t[i-2][j-1] = true;
				t[i-2][j] = true;
				t[i-2][j+1] = true;
				t[i-1][j+2] = true;
				t[i][j+2] = true;
				t[i+1][j+2] = true;
				t[i-1][j-2] = true;
				t[i][j-2] = true;
				t[i+1][j-2] = true;
			}
		}
	}
	bool ret;
	foreach(i; 2..12) {
		foreach(j; 2..12) {
			m[i][j] = t[i][j] && s[i][j];
			ret |= m[i][j];
		}
	}
	return ret;
}

void main() {
	auto xy = map!(to!int)(readln().strip().split());
	while(xy[0]|xy[1]){
		auto m = new bool[][](10+4,10+4);
		m[xy[0]+2][xy[1]+2] = true;
		int n = to!int(readln().strip());
		auto s = map!(to!int)(readln().strip().split());
		bool f = true;
		foreach(i; 0..n){
			f &= next(m, s[i*2]+2, s[i*2+1]+2);
		}
		writeln(f?"OK":"NA");
		xy = map!(to!int)(readln().strip().split());
	}
}