#include <iostream>
#include <vector>
using namespace std;
int main()
{
  int a,b;
  vector<int> v(100);
  while(cin >> a >> b){
    if(a == 0 && b == 0){
      if(v[1] % 2 == 0 || v[2] % 2 == 0) a = 1;
      else{
	for(int i = 3; v[i] != 0; i++){
	  if(v[i] % 2 == 1){
	    a = 1;
	    break;
	  }
	}
      }
      if(a) cout << "NG" << endl;
      else cout << "OK" << endl;
      v.clear();
    }
    v[a]++;
    v[b]++;
  }
  return 0;
}