#include <iostream>
#include <cmath>
#include <cstring>
#include <deque>

using namespace std;

#define MAX_YX 10

int park[MAX_YX][MAX_YX];

int n;
int sy, sx;

int dy[] = {-2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2};
int dx[] = {-1, 0, 1, -2, 2, -2, 2, -2, 2, -1, 0, 1};
bool dfs(int y, int x, int t) {
	if (t == n) {
		if (park[y][x] >> (n-1)) return true;
		else return false;
	}
	for (int i = 0; i < 12; i++) {
		int ny = y + dy[i];
		int nx = x + dx[i];
		if (0 <= ny && ny < MAX_YX && 
		    0 <= nx && nx < MAX_YX && (park[ny][nx] >> t) & 1) {
			if (dfs(ny, nx, t+1)) return true;
		} 
	}
	return false;
}

int main() {
	while (cin >> sx >> sy, sx || sy) {
		cin >> n;
		memset(park, 0, sizeof(park));
		for (int i = 0; i < n; i++) {
			int spx, spy; cin >> spx >> spy;

			for (int j = spy-1; j <= spy+1; j++) {
				for (int k = spx-1; k <= spx+1; k++) {
					if (0 <= j && j < MAX_YX && 0 <= k && k < MAX_YX) {
						park[j][k] |= (1 << i);
					}
				}
			}
		}

		if (dfs(sy, sx, 0)) {
			cout << "OK" << endl;
		} else {
			cout << "NG" << endl;
		}

	}
	return 0;
}