#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b;
  while (cin >> a >> b) {
    int deg[100] = {};
    deg[0]++; deg[1]++;
    deg[a - 1]++; deg[b - 1]++;
    while (cin >> a >> b, a) {
      deg[a - 1]++; deg[b - 1]++;
    }
    bool ok = true;
    for (int i = 0; i < 100; i++) {
      ok &= deg[i] % 2 == 0;
    }
    cout << (ok ? "OK" : "NG") << endl;
  }

  return 0;
}
