#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

struct St{
  int x;
  int y;
  int sp;
};

int ydir[12] = {-1, 0, 1, -2, 2, -2, 2, -2, 2, -1, 0, 1};
int xdir[12] = {-2, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 2};

bool bfs(bool a[11][11][11], St py, int n)
{
  bool f = false;
  queue<St> que;
  que.push(py);
  St s, t;

  while(!que.empty()){
    s = que.front();
    que.pop();
    if(s.sp == n){
      f = true;
      break;
    }
    t.sp = s.sp+1;
    for(int i = 0; i < 12; i++){
      t.y = s.y + ydir[i];
      t.x = s.x + xdir[i];

      if(0 <= t.x && t.x <= 9 && 0 <= t.y && t.y <= 9 && a[t.x][t.y][t.sp]){
	que.push(t);
	a[t.x][t.y][t.sp] = false;
      }
    }
  }

  return f;
}

int main()
{
  int n, s, t;
  St py;
  bool a[11][11][11];

  while(cin>>py.x>>py.y && (py.x+py.y)){
    cin >> n;
    py.sp = 0;
    fill(&a[0][0][0], &a[10][10][10], false);
    for(int i = 1; i <= n; i++){
      cin >> s >> t;
      for(int j = -1; j < 2; j++){
	for(int k = -1; k < 2; k++){
	  int dx = s+j, dy = t+k;
	  if(0 <= dx && dx <= 9 && 0 <= dy && dy <= 9){
	    a[dx][dy][i] = true;
	  }
	}
      }
    }

    cout << ((bfs(a, py, n))? "OK" : "NG") << endl;
  }

  return 0;
}