#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.txt"

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};


int main() {
	while (1) {
		int a, b;
		vector<int>nums(10000);
		while (1) {
			if (!(cin >> a >> b)) {
				return 0;
			}
			else {
				if (!a)break;
				nums[a - 1]++;
				nums[b - 1]++;
			}
		}
		bool ok = true;
		for (int i = 0; i < 2; ++i) {
			if (nums[i] % 2 == 0)ok = false;
		}
		for (int i = 2; i < 10000; ++i) {
			if (nums[i] % 2 == 1)ok = false;
		}
		if (ok)cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}