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

int main() {
  int a[101], m, x, y;
  bool b = true;
  m = 0;
  memset(a, 0, sizeof(int)*101);
  while (cin >> x >> y) {
    if (!x && !y) {
      if (a[1]&1 && a[2]&1) {
        for (int i=3; i<=m; i++) {
          if (a[i]&1) {
            b = false;
            break;
          }
        }
      } else {
        b = false;
      }
      if (b) cout << "OK" << endl;
      else cout << "NG" << endl;
      m = 0;
      memset(a, 0, sizeof(int)*101);
    } else {
      m = max(m, max(x, y));
      ++a[x];
      ++a[y];
    }
  }
}