#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<vector>
#include<cstring>
using namespace std;
#define fr first
#define sc second
typedef pair<int,int> P;
int main(){
  int a , b ;
  int ROAD_sum[102]={};
  while(cin >> a >> b){
    if(a == 0 && b == 0){
      bool ok = true;
      if( ROAD_sum[1] % 2 == 0 || ROAD_sum[2] %2 == 0){
        ok = false;
      }
      for(int i = 3;i<=101;i++){
        if(ROAD_sum[i] % 2 == 1) ok = false;
      }
      cout << ( ok ? "OK" : "NG" ) << endl;
      memset(ROAD_sum,0,sizeof(ROAD_sum));
    }else ROAD_sum[a]++ , ROAD_sum[b]++;
  }
}