
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

int v[101];

int main(){
  int a, b;
  bool ng;
  while(cin >> a >> b){
    v[a]++, v[b]++;
    if(a == 0){
      ng = false;
      if(v[1] % 2 == 0 || v[2] % 2 == 0){
	ng = true;
      }
      for(int i=3; i<101; ++i){
	if(v[i] % 2 == 1){
	  ng = true;
	}
      }
      if(ng){
	cout << "NG" << endl;
      } else { 
	cout << "OK" << endl;
      }
      memset(v, 0, sizeof(v));
    }
  }
    
  return 0;
}