#include <bits/stdc++.h>
using namespace std;

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
};
bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void visit(const Graph &g, vector< vector<int> > &adj, int s, vector<int> &path) {
  for(auto&& e : g[s]) if (adj[e.src][e.dst]) {
    --adj[e.src][e.dst];
    --adj[e.dst][e.src];
    visit(g, adj, e.dst, path);
  }
  path.push_back(s);
}
bool eulerPath(const Graph &g, int s, vector<int> &path) {
  int n = g.size();
  int odd = 0, m = 0;
  for (int i = 0; i < n; ++i) {
    if (g[i].size() % 2 == 1) ++odd;
    m += g[i].size();
  }
  m /= 2;
  if (odd == 0 || (odd == 2 && g[s].size() % 2 == 0)) {
    vector< vector<int> > adj(n, vector<int>(n));
    for (int u = 0; u < n; ++u) {
      for (auto&& e : g[u]) ++adj[e.src][e.dst];
    }
    path.clear();
    visit(g, adj, s, path);
    reverse(begin(path), end(path));
    return path.size() == m + 1;
  }
  return false;
}

int main() {
  int a, b, m = 0;
  Graph G(100);
  while (cin >> a >> b) {
    do {
      m = max({m, a, b});
      --a; --b;
      G[a].push_back({a, b, 1});
      G[b].push_back({b, a, 1});
    } while (cin >> a >> b && a != 0);
    G.resize(m);
    vector<int> path;
    cout << ( (!eulerPath(G, 0, path)) ? "OK" : "NG" ) << endl;
  }
  return 0;
}

