#include <iostream>

using namespace std;

int closs[110];

void calc(){
  int flag = 0;
  
  for(int i = 0;i < 110;i++){
    // cout << closs[i] << " ";
    if(closs[i] % 2 == 1){
      flag = 1;
    }
  }
  
  if(flag == 1)cout << "NG" << endl;
  if(flag == 0)cout << "OK" << endl;
}

int main(void){
  int a,b;

  while(cin >> a >> b){
    if(a != 0 && b != 0){
      if(a != 1 && a != 2)
	closs[a]++;
      if(b != 1 && b != 2)
	closs[b]++;
    }else{
      calc();

      for(int i = 0;i < 110;i++)
	closs[i] = 0;
    }
  }

  return 0;
}