#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  while (true) {
    vector<vector<int>> vec(101, vector<int>(0));
    int a, b;
    while (cin >> a >> b, b) {
      vec[a].push_back(b);
      vec[b].push_back(a);
    }

    if (cin.fail())
      break;

    bool flag = vec[1].size() % 2 != 0 && vec[2].size() % 2 != 0;
    for (int i = 3; i < 101; ++i)
      if (vec[i].size() % 2 != 0)
        flag = false;
    cout << (flag ? "OK" : "NG") << endl;
  }
}
