#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (int)(count); i++)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 100000 ;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

using namespace std;

int x,y,n,a[10],b[10];

void solve(){
	cin>>n;
	FOR(i,n) cin>>a[i]>>b[i];
	vector<Pii> ok;
	ok.push_back(Pii(x,y));
	FOR(i,n){
		vector<Pii> nxt;
		for(int j = -1; j <= 1; j++) for(int k = -1; k <= 1; k++){
			int nx = a[i]+j,ny = b[i]+k;
			if(0 <= nx && nx <= 9 && 0 <= ny && ny <= 9){
				FOR(l,sz(ok)){
					int dx = abs(ok[l].first - nx),dy = abs(ok[l].second - ny);
					if((dx == 2 || dy == 2) && dx + dy < 4){
						nxt.push_back(Pii(nx,ny));
						break;
					}
				}
			}
		}
		swap(ok,nxt);
	}
	if(ok.size() != 0){
		puts("OK");
	} else {
		puts("NA");
	}
}

int main()
{
	while(cin>>x>>y,(x||y)){
		solve();
	}

	return 0;
}