#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int n;
int d[10][2]={0};
int dx[]={-2,-2,-2,-1,-1, 0, 0, 1, 1, 2, 2, 2};
int dy[]={-1, 0, 1,-2, 2,-2, 2,-2, 2,-1, 0, 1};
bool func(int a,int kx,int ky){
	rep(i,12){
		int nx=kx+dx[i],ny=ky+dy[i];
		if(nx<0||ny<0||nx>10||ny>10)continue;
		loop(j,-1,2)loop(k,-1,2){
			if(nx==d[a][0]+j&&ny==d[a][1]+k){
				if(a+1==n){return true;}
				if(func(a+1,nx,ny))return true;
			}
		}
	}
	return 0;
}
int main(){
	int kx,ky;
	while(cin>>kx>>ky,kx||ky){
		cin>>n;
		rep(i,n)rep(j,2)cin>>d[i][j];
		cout<<(func(0,kx,ky)?"OK":"NG")<<endl;
	}
}