#include <iostream>
#include <algorithm>
using namespace std;

#define MAX 100

int main() {

  while(1) {
    int a=-1, b;
    int V = 0;
    int edge[MAX]={};
    while(cin>>a>>b&&(a+b)) {
      V = max(V, max(a, b));
      a--, b--;
      edge[a]++, edge[b]++;
    }
    
    if(a==-1) break;
    
    bool flag = false;
    
    if( edge[0]%2==0 || edge[1]%2==0 ) flag = true;
    
    for( int i=2; i<V; i++ ) if( edge[i] % 2 == 1 ) flag = true;
    
    cout << ( flag ? "NG" : "OK" ) << endl;
  }
  
  return 0;
}