#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

template<int MV> class UndirectedEulerPath {
public:
	vector<int> path;
	multiset<int> E[MV];
	void add_path(int x, int y) { E[x].insert(y); E[y].insert(x); }

	void dfs(int cur) {
		while (E[cur].size()) {
			int tar = *E[cur].begin();
			E[cur].erase(E[cur].begin());
			E[tar].erase(E[tar].find(cur));
			dfs(tar);
		}
		path.push_back(cur);
	}

	bool GetPath() {
		int fo = -1, odd = 0, i, np = 0;
		rep(i, 0, MV) {
			np += E[i].size();
			if (E[i].size() % 2) odd++, fo = (fo == -1) ? i : fo;
		}
		if (odd != 0 && odd != 2) return false;
		dfs(odd ? fo : 0);
		reverse(path.begin(), path.end());
		return path.size() == np / 2 + 1;
	}
};
//-----------------------------------------------------------------
int main() {
	int a, b;
	while (cin >> a >> b) {
		UndirectedEulerPath<105> ep;
		ep.add_path(a, b);
		while (cin >> a >> b) {
			if (a == 0 && b == 0) break;
			ep.add_path(a, b);
		}

		if (ep.GetPath() && (ep.path.front() == 1 && ep.path.back() == 2))
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
}