#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#include <vector>

using namespace std;

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};
class State{
	public:
	int x;
	int y;
	int time;
};

int main(void){
	int visited[10][10];
	int posx, posy, num;
	int tmpx, tmpy;
	deque<State> q;
	vector<pair<int,int> > sp;
	
	while(cin >> posx >> posy){
		if((posx | posy) == 0) break;

		State s,t;
		bool end = false;

		cin >> num;
		q.clear(); sp.clear();
		s.x = posx;
		s.y = posy;
		s.time = 0;
		q.push_back(s);
		
		memset(visited,0,sizeof(visited));
		for(int i=0;i<num;i++){
			cin >> tmpx >> tmpy;
			sp.push_back(make_pair(tmpx, tmpy));
		}
		
		if(num == 0){
			cout << "NG" << endl;
			continue;
		}
		
		while(!q.empty()){
			s = q.front(); q.pop_front();
			
			//printf("[%d]x = %d, y = %d\n", s.time, s.x, s.y);
			//printf("next sprinkler = %d, %d\n", sp[s.time%num].first, sp[s.time%num].second);
			if(s.time == num){
				end = true;
				cout << "OK" << endl;
				break;
			}

			for(int i=0;i<12;i++){
				//òÑoµÄ¢È­Ä©ÂXvNàÈç
				//printf("try %d, %d\n", s.x+dx[i], s.y+dy[i]);
				if(0 <= s.x + dx[i] && s.x + dx[i] <= 9 &&
				0 <= s.y + dy[i] && s.y + dy[i] <= 9 &&
				abs(sp[s.time%num].first - (s.x+dx[i])) <= 1 &&
				abs(sp[s.time%num].second - (s.y+dy[i])) <= 1){
					t.x = s.x+dx[i];
					t.y = s.y+dy[i];
					t.time = s.time+1;
					q.push_back(t);
					//cout << "push " << t.x << " " << t.y << endl;
 				}
			}
		}
		if(!end){
			cout << "NG" << endl;
		}
	}
}