#include <iostream>

using namespace std;

int main(){
  int a,b,m;
  bool f;
  while(cin>>a>>b){
    f=true;
    m=0;
    int x[101]={0};
    ++x[a];++x[b];
    if(a>m||b>m) m=(a>b)?a:b;
    while(1){
      cin>>a>>b;
      if(a==0&&b==0) break;
      ++x[a];++x[b];
      if(a>m||b>m) m=(a>b)?a:b;   
    }
    for(int i=3;i<=m;++i){
      if(x[i]%2==1){
	cout<<"NG"<<endl;f=false;break;
      }
    }
    if(f) cout<<"OK"<<endl;
  }
  return 0;
}