#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

void solve() {
	int a, b;
	vector<pair<int, int> > edges;
	int maxNode = 0;
	while (cin >> a >> b, a || b) {
		maxNode = max(a, max(b, maxNode));
		edges.push_back(make_pair(a, b));
	}
	if (!cin.good()) return;
	int nodes[maxNode];
	memset(nodes, 0, sizeof(nodes));
	for (unsigned i = 0; i < edges.size(); i++) {
		nodes[edges[i].first - 1]++;
		nodes[edges[i].second - 1]++;
	}
	if (!(nodes[0] & 1u) || !(nodes[1] & 1u)) {
		cout << "NG" << endl;
		return;
	}
	for (int i = 2; i < maxNode; i++) {
		if (nodes[i] & 1u) {
			cout << "NG" << endl;
			return;
		}
	}
	cout << "OK" << endl;
}

int main () {
	while (cin.good()) {
		solve();
	}
	return 0;
}