#include <iostream>
#include <string.h>
using namespace std;

int main(void){
  int i,a,b,flg,s[104];

  while(1){
    memset(s,0,sizeof(s));
    while(1){
      if(!(cin>>a>>b)) return 0;
      if(!a && !b) break;
      s[a]++;
      s[b]++;
    }

    flg = 0;
    if(s[1] % 2 == 1 && s[2] % 2 == 1){
      flg = 1;
    }

    for(i=3;i<104 && flg==1;i++){
      if(s[i] != 0 && s[i] % 2 == 1){
        flg = 0;
      }
    }

    if(flg){
      cout<<"OK\n";
    }
    else{
      cout<<"NG\n";
    }
  }
}