#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

int main() {
  int c[101] =  { 0 };
  int a, b;
  while (cin >> a >> b) {
    if (a + b == 0) {
      int t = 0;
      for (int i = 3; i < 101; i++) {
        t += c[i] % 2;
      }
      if (t == 0 && c[1] % 2 && c[2] % 2) {
        cout << "OK" << endl;
      } else {
        cout << "NG" << endl;
      }

      memset(c, 0, sizeof(c));

    } else {
      c[a]++;
      c[b]++;
    }    
    
  }
  
  return 0;
}