#include <iostream>
#include <vector>

using namespace std;

vector<int> graph[100];

int main(){
  graph[0].push_back(1);
  graph[1].push_back(0);
  int a,b;
  while(cin>>a>>b){
    if(a==0&&b==0){
      bool is_euler = true;
      for(int i=0;i<100;++i){
        if(graph[i].size()%2==1){
          is_euler = false;
          break;
        }
      }
      if(is_euler){
        cout << "OK" << endl;
      }else{
        cout << "NG" << endl;
      }

      for(int i=0;i<100;++i){
        graph[i].resize(0);
      }
      graph[0].push_back(1);
      graph[1].push_back(0);
    }else{
      graph[a-1].push_back(b-1);
      graph[b-1].push_back(a-1);
    }
  }
  return 0;
}